refactor: reorder the reg link
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { isMobile } from '../../common/utils';
|
||||
|
||||
export default function SignInLink({ token }: { token?: string }) {
|
||||
const { t } = useTranslation("auth");
|
||||
const navigate = useNavigate();
|
||||
const handleSignIn = () => {
|
||||
navigate("/login");
|
||||
};
|
||||
useEffect(() => {
|
||||
// 移动端访问,则跳转
|
||||
if (isMobile() && !!token) {
|
||||
@@ -19,7 +15,7 @@ export default function SignInLink({ token }: { token?: string }) {
|
||||
return (
|
||||
<div className="flex gap-1 mt-7 text-sm text-slate-500 dark:text-gray-100 justify-center">
|
||||
<span>{t("reg.have_account")}</span>
|
||||
<a onClick={handleSignIn} className="text-primary-400 cursor-pointer">{t("sign_in")}</a>
|
||||
<NavLink to={"/login"} className="text-primary-400 cursor-pointer">{t("sign_in")}</NavLink>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { useEffect } from "react";
|
||||
import { Outlet } from "react-router-dom";
|
||||
|
||||
export default function RegContainer() {
|
||||
useEffect(() => {
|
||||
// 重新组织url
|
||||
location.href = `${location.origin}${location.hash}${location.search}`;
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<div className="flex-center h-screen overflow-x-hidden overflow-y-auto dark:bg-gray-700">
|
||||
<div className="py-8 px-10 shadow-md rounded-xl">
|
||||
|
||||
Reference in New Issue
Block a user