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

View File

@@ -218,6 +218,7 @@ import {useRouter} from "vue-router";
import Clipboard from "clipboard";
import ConfigDialog from "@/components/ConfigDialog.vue";
import PasswordDialog from "@/components/PasswordDialog.vue";
import {checkSession} from "@/action/session";
const title = ref('ChatGPT-智能助手');
const logo = 'images/logo.png';
@@ -278,16 +279,6 @@ onMounted(() => {
})
});
const checkSession = function () {
return new Promise((resolve, reject) => {
httpGet('/api/user/session').then(res => {
resolve(res)
}).catch(err => {
reject(err)
})
})
}
// 加载会话
const loadChats = function () {
httpGet("/api/chat/list?user_id=" + user.value.id).then((res) => {