simplify payload and cookie removal

This commit is contained in:
jb-alvarado 2020-05-24 17:51:06 +02:00
parent dbe4001c62
commit c453616a64

View File

@ -59,8 +59,7 @@ export const actions = {
},
async refreshToken ({ commit, state }) {
const payload = {
refresh: state.jwtRefresh,
progress: false
refresh: state.jwtRefresh
}
await this.$axios.post('auth/token/refresh/', payload)
@ -70,9 +69,7 @@ export const actions = {
})
.catch((error) => {
if (error.response.status === 401) {
this.$cookies.remove('token')
this.$cookies.remove('refresh')
commit('UPADTE_TOKEN', { token: null, refresh: null })
commit('REMOVE_TOKEN')
commit('UPDATE_IS_LOGIN', false)
}
})