Procházet zdrojové kódy

"/anonymous/sign-in" => TO_SIGN_IN

visuddhinanda před 6 dny
rodič
revize
8c9d946920

+ 2 - 1
dashboard-v6/src/components/auth/Avatar.tsx

@@ -14,6 +14,7 @@ import {
 import { useAppSelector } from "../../hooks";
 import {
   currentUser as _currentUser,
+  TO_SIGN_IN,
   type IUser,
 } from "../../reducers/current-user";
 import type { TooltipPlacement } from "antd/lib/tooltip";
@@ -58,7 +59,7 @@ const UserCard = ({ user }: IUserCard) => {
             onClick={() => {
               sessionStorage.removeItem("token");
               localStorage.removeItem("token");
-              navigate("/anonymous/users/sign-in");
+              navigate(TO_SIGN_IN);
             }}
           />
         </Tooltip>,

+ 2 - 2
dashboard-v6/src/components/auth/LoginAlertModal.tsx

@@ -3,7 +3,7 @@ import { Modal } from "antd";
 import { ExclamationCircleOutlined } from "@ant-design/icons";
 
 import { useAppSelector } from "../../hooks";
-import { isGuest } from "../../reducers/current-user";
+import { isGuest, TO_SIGN_IN } from "../../reducers/current-user";
 import { useEffect } from "react";
 import { useNavigate } from "react-router";
 
@@ -37,7 +37,7 @@ const LoginAlertModalWidget = ({ enable = false, mode = "read" }: IWidget) => {
         cancelText: intl.formatMessage({
           id: "buttons.use.as.guest",
         }),
-        onOk: () => navigate("/anonymous/users/sign-in"),
+        onOk: () => navigate(TO_SIGN_IN),
         onCancel: () => localStorage.setItem("guest_mode", "true"),
       });
     }

+ 2 - 1
dashboard-v6/src/components/auth/LoginButton.tsx

@@ -1,5 +1,6 @@
 import { useIntl } from "react-intl";
 import { Link } from "react-router";
+import { TO_SIGN_IN } from "../../reducers/current-user";
 
 interface IWidget {
   target?: React.HTMLAttributeAnchorTarget;
@@ -9,7 +10,7 @@ const LoginButton = ({ target }: IWidget) => {
   const url = btoa(window.location.href);
 
   return (
-    <Link to={`/anonymous/sign-in?url=${url}`} target={target}>
+    <Link to={`${TO_SIGN_IN}?url=${url}`} target={target}>
       {intl.formatMessage({
         id: "nut.users.sign-in-up.title",
       })}

+ 2 - 1
dashboard-v6/src/components/auth/SignInAvatar.tsx

@@ -16,6 +16,7 @@ import { useAppSelector } from "../../hooks";
 import {
   currentUser as _currentUser,
   studioList,
+  TO_SIGN_IN,
 } from "../../reducers/current-user";
 import type { TooltipPlacement } from "antd/lib/tooltip";
 import SettingModal from "../setting/SettingModal";
@@ -146,7 +147,7 @@ const SignInAvatar = ({
                       case "logout":
                         sessionStorage.removeItem("token");
                         localStorage.removeItem("token");
-                        navigate("/anonymous/users/sign-in");
+                        navigate(TO_SIGN_IN);
                         break;
                     }
                   }}

+ 2 - 1
dashboard-v6/src/components/users/NonSignInSharedLinks.tsx

@@ -1,11 +1,12 @@
 import { FormattedMessage } from "react-intl";
 import { Link } from "react-router";
 import { Divider, Space } from "antd";
+import { TO_SIGN_IN } from "../../reducers/current-user";
 
 const Widget = () => {
   return (
     <Space>
-      <Link to="/anonymous/sign-in">
+      <Link to={TO_SIGN_IN}>
         <FormattedMessage id="buttons.sign-in" />
       </Link>
       <Divider orientation="vertical" />

+ 2 - 4
dashboard-v6/src/components/users/SignUp.tsx

@@ -15,6 +15,7 @@ import { get } from "../../request";
 import LangSelect from "../general/LangSelect";
 import type { IInviteResponse } from "../../api/Auth";
 import { onSignIn } from "./utils";
+import { TO_SIGN_IN } from "../../reducers/current-user";
 
 export interface IAccountForm {
   email: string;
@@ -143,10 +144,7 @@ export const SignUpSuccess = () => {
       status="success"
       title="注册成功"
       subTitle={
-        <Button
-          type="primary"
-          onClick={() => navigate("/anonymous/users/sign-in")}
-        >
+        <Button type="primary" onClick={() => navigate(TO_SIGN_IN)}>
           {intl.formatMessage({
             id: "buttons.sign-in",
           })}

+ 2 - 1
dashboard-v6/src/layouts/dashboard/index.tsx

@@ -2,12 +2,13 @@ import { Navigate, Outlet } from "react-router";
 
 import Footer from "../Footer";
 import { useAuth } from "../../hooks/useAuth";
+import { TO_SIGN_IN } from "../../reducers/current-user";
 
 const Widget = () => {
   const { isAuthenticated } = useAuth();
 
   if (!isAuthenticated) {
-    return <Navigate to="/anonymous/sign-in" replace />;
+    return <Navigate to={TO_SIGN_IN} replace />;
   }
   // TODO
   return (