mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 05:28:13 +00:00
axios: baseURL
This commit is contained in:
+4
-8
@@ -6,23 +6,20 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import dataMixin from './mixins/dataMixin';
|
||||
import PopUpCard from './components/PopUpCard.vue';
|
||||
import axios from 'axios';
|
||||
import { RouterView } from 'vue-router';
|
||||
import { IUser, AuthState } from './types/types';
|
||||
import { AuthState } from './types/types';
|
||||
import useRouteGuard from './mixins/useRouteGuard';
|
||||
import { useStore } from './store';
|
||||
import useLocalStorage from './mixins/useLocalStorage';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dataMixin],
|
||||
components: { PopUpCard },
|
||||
|
||||
setup() {
|
||||
const { routeAuthGuard } = useRouteGuard();
|
||||
const { setupStorage } = useLocalStorage();
|
||||
|
||||
|
||||
routeAuthGuard();
|
||||
setupStorage();
|
||||
|
||||
@@ -41,9 +38,8 @@ export default defineComponent({
|
||||
|
||||
this.store.token = token;
|
||||
|
||||
const data = axios.post<{ user: IUser }>(`${this.API_URL}/auth/token`, { token: this.store.token });
|
||||
|
||||
data
|
||||
this.store
|
||||
.fetchTokenData()
|
||||
.then((res) => {
|
||||
this.store.user = res.data.user;
|
||||
this.store.authState = AuthState.AUTHORIZED;
|
||||
|
||||
Reference in New Issue
Block a user