diff --git a/src/App.vue b/src/App.vue index 691c3ac..d358d12 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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; } }, }, diff --git a/src/store.ts b/src/store.ts index bd33197..47bb89d 100644 --- a/src/store.ts +++ b/src/store.ts @@ -14,12 +14,13 @@ export const useStore = defineStore('store', { stationList: [], backupList: [], stationsToRemove: [], - searchedSceneryName: '', changeList: [], newStationsCount: 0, routesModalVisible: true, currentStation: null, + searchedSceneryName: '', selectedStationName: '', + user: null, notifyDiscord: true, diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index 867ff19..e723326 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -1,5 +1,5 @@