mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 05:28:13 +00:00
fix routingu
This commit is contained in:
@@ -32,6 +32,8 @@ export default defineComponent({
|
||||
methods: {
|
||||
async autoLogin() {
|
||||
try {
|
||||
this.store.authState = AuthState.LOADING;
|
||||
|
||||
const response = await axios.post(
|
||||
'/auth/token',
|
||||
{},
|
||||
@@ -42,9 +44,12 @@ export default defineComponent({
|
||||
);
|
||||
|
||||
this.store.user = response.data;
|
||||
this.store.authState = AuthState.AUTHORIZED;
|
||||
|
||||
this.$router.push('/');
|
||||
} catch (error) {
|
||||
this.$router.push('/login');
|
||||
this.store.authState = AuthState.UNAUTHORIZED;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user