РГ
Size: a a a
РГ
AE
AE
РГ
РГ
AE
AE
AE
РГ
АР
R
AE
const loginuser = await this.$axios.post('/login', {
username: this.username,
password: this.password
})
this.$axios.setToken(loginuser.data.token, 'Bearer')
const { data } = await this.$axios.post('/check')
if (data.status === 'success') {}
}
AE
РГ
const loginuser = await this.$axios.post('/login', {
username: this.username,
password: this.password
})
this.$axios.setToken(loginuser.data.token, 'Bearer')
const { data } = await this.$axios.post('/check')
if (data.status === 'success') {}
}
login({ commit }, credentials) {
return ApiService.login(credentials)
.then(response => {
const userId = jwtDecode(response.data.access).user_id
ApiService.ApiService.defaults.headers.common[
'Authorization'
] = `Bearer ${response.data.access}`
TokenService.saveToken('access', response.data.access)
TokenService.saveToken('refresh', response.data.refresh)
commit('SET_AUTH_USER')
commit('SET_USER_ID', userId)
})
.catch(error => {
throw error
})
},
AE
login({ commit }, credentials) {
return ApiService.login(credentials)
.then(response => {
const userId = jwtDecode(response.data.access).user_id
ApiService.ApiService.defaults.headers.common[
'Authorization'
] = `Bearer ${response.data.access}`
TokenService.saveToken('access', response.data.access)
TokenService.saveToken('refresh', response.data.refresh)
commit('SET_AUTH_USER')
commit('SET_USER_ID', userId)
})
.catch(error => {
throw error
})
},
РГ
РГ
AE
РГ
AE