Verified Commit 45e84210 authored by Agate's avatar Agate 💬

Fixed broken login redirection when 401

parent e0820dfa
Pipeline #393 passed with stage
in 2 minutes and 9 seconds
......@@ -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)
------------------
......
......@@ -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)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment