Merge branch 'fixed-broken-redirect-to-login' into 'develop'

Fixed broken login redirection when 401

See merge request funkwhale/funkwhale!41
merge-requests/154/head
Eliot Berriot 2018-02-15 19:02:01 +00:00
commit cbaa38c47b
2 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -5,6 +5,9 @@ Changelog
0.3.5 (Unreleased)
------------------
- Front: added some unittests for the store (#55)
- Front: fixed broken login redirection when 401
0.3.5 (2018-01-07)
------------------

Wyświetl plik

@ -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)
})