fix routingu

This commit is contained in:
2023-09-16 18:34:59 +02:00
parent 56246f271a
commit 48efd21178
3 changed files with 18 additions and 14 deletions
+5
View File
@@ -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;
}
},
},