opt: 抽离 session 验证函数,修正前端路由覆盖 bug

This commit is contained in:
RockYang
2023-06-23 06:31:25 +08:00
parent cba54be913
commit 05bdd81646
7 changed files with 94 additions and 67 deletions

21
web/src/action/session.js Normal file
View File

@@ -0,0 +1,21 @@
import {httpGet} from "@/utils/http";
export function checkSession() {
return new Promise((resolve, reject) => {
httpGet('/api/user/session').then(res => {
resolve(res)
}).catch(err => {
reject(err)
})
})
}
export function checkAdminSession() {
return new Promise((resolve, reject) => {
httpGet('/api/admin/session').then(res => {
resolve(res)
}).catch(err => {
reject(err)
})
})
}