mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 17:39:31 +02:00
Fixed broken login redirection when 401
This commit is contained in:
parent
e0820dfa1c
commit
45e8421061
2 changed files with 6 additions and 3 deletions
|
@ -37,13 +37,13 @@ axios.interceptors.request.use(function (config) {
|
|||
|
||||
// Add a response interceptor
|
||||
axios.interceptors.response.use(function (response) {
|
||||
if (response.status === 401) {
|
||||
return response
|
||||
}, function (error) {
|
||||
if (error.response.status === 401) {
|
||||
store.commit('auth/authenticated', false)
|
||||
logger.default.warn('Received 401 response from API, redirecting to login form')
|
||||
router.push({name: 'login', query: {next: router.currentRoute.fullPath}})
|
||||
}
|
||||
return response
|
||||
}, function (error) {
|
||||
// Do something with response error
|
||||
return Promise.reject(error)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue