mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 13:38:13 +00:00
fix loginu
This commit is contained in:
+4
-3
@@ -12,6 +12,7 @@ import { AuthState } from './types/types';
|
||||
import { baseURL, useStore } from './store';
|
||||
import useLocalStorage from './mixins/useLocalStorage';
|
||||
import axios from 'axios';
|
||||
import { IUser } from './types/types';
|
||||
|
||||
export default defineComponent({
|
||||
components: { PopUpCard },
|
||||
@@ -32,7 +33,7 @@ export default defineComponent({
|
||||
try {
|
||||
this.tokenLoading = true;
|
||||
|
||||
const response = await axios.post(
|
||||
const response = await axios.post<IUser>(
|
||||
'/auth/token',
|
||||
{},
|
||||
{
|
||||
@@ -41,11 +42,11 @@ export default defineComponent({
|
||||
}
|
||||
);
|
||||
|
||||
this.store.setUserData(response.data);
|
||||
this.$router.push('/');
|
||||
this.store.user = response.data;
|
||||
} catch (error) {
|
||||
this.store.removeUserData();
|
||||
this.$router.push('/login');
|
||||
this.store.user = null;
|
||||
}
|
||||
|
||||
this.tokenLoading = false;
|
||||
|
||||
Reference in New Issue
Block a user