feat: Redirect to console if logged in and accessing auth pages

This commit introduces a new component `AuthRedirect` which checks
if a user is already logged in.

If the user is logged in and attempts to access the /login or /register
pages, they will be redirected to the /console page. Otherwise, the
respective authentication form (Login or Register) will be rendered.

The `App.js` file has been updated to utilize this new `AuthRedirect`
component for the /login and /register routes.
This commit is contained in:
Apple\Apple
2025-05-20 11:53:04 +08:00
parent 881ad57a02
commit 28d401ec01
3 changed files with 22 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ const Home = () => {
{/* 操作按钮 */}
<div className="mt-6 md:mt-10 flex flex-wrap gap-4 justify-center md:justify-start">
<Link to="/login">
<Link to="/console">
<Button theme="solid" type="primary" size="large">
{t('开始使用')}
</Button>