feat: 登录与websocket 初始化相关的调整

This commit is contained in:
2025-09-23 20:00:30 +08:00
parent 96746df7c9
commit 8720c43570
4 changed files with 24 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
import { goLogin } from "../../hooks/useGoLogin";
import { BASE_URL } from "./baseUrl";
import { getCurrentConfig } from "@/constant/base";
import { useAppStore } from "@/store";
import { NOTICE_EVENT_LOGOUT } from "@/constant/constant";
const clientId = getCurrentConfig().clientId;
const defaultConfig = {
@@ -55,6 +57,10 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
resolve(res.data);
if (res.statusCode && res.statusCode === 424) {
console.log("424错误重新登录");
uni.setStorageSync("token", "");
const appStore = useAppStore();
appStore.setHasToken(false);
uni.$emit(NOTICE_EVENT_LOGOUT);
goLogin();
}
},