Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/App.vue
Show All 23 Lines | export default { | ||||
// whenever a route changes. Normally vue does not do that. | // whenever a route changes. Normally vue does not do that. | ||||
return this.$route.name == '404' ? this.$route.path : 'static' | return this.$route.name == '404' ? this.$route.path : 'static' | ||||
} | } | ||||
}, | }, | ||||
mounted() { | mounted() { | ||||
const token = localStorage.getItem('token') | const token = localStorage.getItem('token') | ||||
if (token) { | if (token) { | ||||
axios.defaults.headers.common.Authorization = 'Bearer ' + token | |||||
const post = { refresh_token: localStorage.getItem("refreshToken") } | const post = { refresh_token: localStorage.getItem("refreshToken") } | ||||
axios.post('/api/auth/info?refresh=1', post, { ignoreErrors: true, loader: true }) | axios.post('/api/auth/info?refresh=1', post, { ignoreErrors: true, loader: true }) | ||||
.then(response => { | .then(response => { | ||||
this.$root.loginUser(response.data, false) | this.$root.loginUser(response.data, false) | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
// Handle the error, on 401 display the logon page | // Handle the error, on 401 display the logon page | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |