app
This commit is contained in:
1 parent
be842cc1d5
commit
9a75589282
13 files changed
+1119
-43
No files matched your search
+2
-1
@@ -1,4 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import { goLogin } from '../utils/navigate'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL ?? '/api',
|
||||
@@ -17,7 +18,7 @@ http.interceptors.response.use(
|
||||
if (error.response?.status === 401 && !error.config?.url?.endsWith('/auth/login')) {
|
||||
localStorage.removeItem('jiaowu_token')
|
||||
localStorage.removeItem('jiaowu_user')
|
||||
window.location.assign(`/login?redirect=${encodeURIComponent(location.pathname)}`)
|
||||
goLogin(location.pathname + location.search + location.hash)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
},
|
||||
|
||||
+6
-4
@@ -3,8 +3,10 @@ import { createPinia } from 'pinia'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { setRouter } from './utils/navigate'
|
||||
|
||||
createApp(App)
|
||||
.use(createPinia())
|
||||
.use(router)
|
||||
.mount('#app')
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
setRouter(router)
|
||||
app.mount('#app')
|
||||
@@ -1,9 +1,11 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
import AdminLayout from '../layouts/AdminLayout.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: import.meta.env.VITE_ROUTER_MODE === 'hash'
|
||||
? createWebHashHistory()
|
||||
: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/login',
|
||||
|
||||
Loaded 3 of 13 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user