fixed bug for: websocket is not auto connected when user not login

This commit is contained in:
RockYang
2024-10-02 07:26:34 +08:00
parent 2a6dd636fa
commit 88e7c39066
9 changed files with 22 additions and 7 deletions

View File

@@ -77,6 +77,7 @@ import ResetPass from "@/components/ResetPass.vue";
import {showMessageError} from "@/utils/dialog";
import Captcha from "@/components/Captcha.vue";
import {setRoute} from "@/store/system";
import {useSharedStore} from "@/store/sharedata";
const router = useRouter();
const title = ref('Geek-AI');
@@ -145,6 +146,7 @@ const login = function () {
}
}
const store = useSharedStore()
const doLogin = (verifyData) => {
httpPost('/api/user/login', {
username: username.value.trim(),
@@ -154,6 +156,7 @@ const doLogin = (verifyData) => {
x: verifyData.x
}).then((res) => {
setUserToken(res.data.token)
store.setIsLogin(true)
needVerify.value = false
if (isMobile()) {
router.push('/mobile')