提交 4a84a7ce authored 作者: lihuihui's avatar lihuihui
......@@ -53,7 +53,7 @@ httpRequest.interceptors.response.use(
if (data.code && data.code !== 999) {
// 未登录
if (data.code === 4001) {
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
window.location.href = `${import.meta.env.VITE_LOGIN_URL}`
}
// 没有权限
if (data.code === 4008 || data.code === 5018) {
......@@ -74,7 +74,7 @@ httpRequest.interceptors.response.use(
const { status, message } = error.response.data
// 未登录
if (status === 403) {
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
window.location.href = `${import.meta.env.VITE_LOGIN_URL}`
} else {
Message.error(message || error.response.data)
}
......
// import store from '@/store'
export default async function (to, from, next) {
// if (to.meta.requiredLogin) {
// } else {
// next()
// }
// const isLogin = store.state.user.id || (await store.dispatch('checkLogin'))
// if (!isLogin) {
// window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
// } else {
console.log(to)
console.log(from)
next()
// }
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论