mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 05:54:34 +02:00
Add authentication followup to front-end to ease navigation & redirects
This commit is contained in:
6
resources/js/api.js
vendored
6
resources/js/api.js
vendored
@ -13,6 +13,12 @@ if (window.appConfig.subdirectory) {
|
||||
}
|
||||
|
||||
Vue.axios.interceptors.response.use(response => response, error => {
|
||||
|
||||
// Whether or not the promise must be returned, if unauthenticated is received
|
||||
// we update the auth state of the front-end
|
||||
if ( error.response.status === 401 ) {
|
||||
Vue.$storage.remove('authenticated')
|
||||
}
|
||||
|
||||
// Return the error when we need to handle it at component level
|
||||
if( error.config.hasOwnProperty('returnError') && error.config.returnError === true ) {
|
||||
|
Reference in New Issue
Block a user