Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/App.vue
Show All 15 Lines | export default { | ||||
if (token) { | if (token) { | ||||
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.isLoading = false | this.isLoading = false | ||||
this.$root.stopLoading() | this.$root.stopLoading() | ||||
this.$root.loginUser(token, false) | this.$root.loginUser({ access_token: token }, false) | ||||
this.$store.state.authInfo = response.data | this.$store.state.authInfo = response.data | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
// Release lock on the router-view, otherwise links (e.g. Logout) will not work | // Release lock on the router-view, otherwise links (e.g. Logout) will not work | ||||
// FIXME: This causes dashboard to call /api/auth/info again | // FIXME: This causes dashboard to call /api/auth/info again | ||||
this.isLoading = false | this.isLoading = false | ||||
this.$root.errorHandler(error) | this.$root.errorHandler(error) | ||||
}) | }) | ||||
Show All 18 Lines |