Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/components/App.vue
Show All 15 Lines | export default { | ||||
this.$root.startLoading() | this.$root.startLoading() | ||||
axios.defaults.headers.common.Authorization = 'Bearer ' + token | axios.defaults.headers.common.Authorization = 'Bearer ' + token | ||||
axios.get('/api/auth/info') | axios.get('/api/auth/info') | ||||
.then(response => { | .then(response => { | ||||
this.$store.state.authInfo = response.data | this.$store.state.authInfo = response.data | ||||
this.isLoading = false | this.isLoading = false | ||||
this.$root.stopLoading() | this.$root.stopLoading() | ||||
this.$root.loginUser(token) | this.$root.loginUser(token, false) | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
this.isLoading = false | this.isLoading = false | ||||
this.$root.stopLoading() | this.$root.stopLoading() | ||||
if (error.response.status === 401 || error.response.status === 403) { | if (error.response.status === 401 || error.response.status === 403) { | ||||
this.$root.logoutUser() | this.$root.logoutUser() | ||||
} | } | ||||
}) | }) | ||||
} else { | } else { | ||||
this.$root.stopLoading() | this.$root.stopLoading() | ||||
this.isLoading = false | this.isLoading = false | ||||
} | } | ||||
}, | }, | ||||
} | } | ||||
</script> | </script> |