🐛 fix client id persistence issue

This commit is contained in:
landaiqing
2024-09-05 17:05:24 +08:00
parent ec6b0a9c9f
commit 834174c7cb
3 changed files with 37 additions and 46 deletions

View File

@@ -28,13 +28,11 @@ const router: Router = createRouter({
router.beforeEach((to, _from, next) => {
start();
const user = useStore().user;
const client = useStore().client;
const token: string | undefined = user.user.refreshToken;
const userId: string | undefined = user.user.userId;
const clientId: string | undefined = client.getClientId();
// 检查用户是否已登录
const isLoggedIn: boolean = token !== "" && userId !== "" && clientId !== "";
const isLoggedIn: boolean = token !== "" && userId !== "";
if (to.path === '/login' || to.path === '/qrlogin' || to.path === '/resetpass') {
if (isLoggedIn) {