Просмотр исходного кода

fix: redirect to workspace after sign-in

登录成功后跳转到 /workspace,而不是无内容的首页 /
visuddhinanda 5 дней назад
Родитель
Сommit
9f8c0da40d

+ 2 - 2
dashboard-v6/src/components/users/SignIn.tsx

@@ -5,7 +5,7 @@ import { useNavigate, useSearchParams } from "react-router";
 import { EyeInvisibleOutlined, EyeTwoTone } from "@ant-design/icons";
 
 import { useAppDispatch } from "../../hooks";
-import { type IUser, signIn, TO_HOME } from "../../reducers/current-user";
+import { type IUser, signIn, TO_WORKSPACE } from "../../reducers/current-user";
 import { get, post } from "../../request";
 import { useState } from "react";
 import { set } from "../../reducers/session";
@@ -65,7 +65,7 @@ const Widget = () => {
                 if (url) {
                   window.location.href = atob(url);
                 } else {
-                  navigate(TO_HOME);
+                  navigate(TO_WORKSPACE);
                 }
               } else {
                 setError("用户名或密码错误");

+ 1 - 0
dashboard-v6/src/reducers/current-user.ts

@@ -9,6 +9,7 @@ export const ROLE_ADMINISTRATOR = "administrator";
 export const TO_SIGN_IN = "/anonymous/sign-in";
 export const TO_PROFILE = "/dashboard/users/logs";
 export const TO_HOME = "/";
+export const TO_WORKSPACE = "/workspace";
 
 const KEY = "token";
 const STUDIO_KEY = "studio";