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