feat: 登录与websocket 初始化相关的调整
This commit is contained in:
@@ -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();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user