Moving auth pages back to the root
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import { useSearchParams, Navigate } from "react-router";
|
||||
import { useTranslation } from "@refinedev/core";
|
||||
import { AuthPage } from "@refinedev/mui";
|
||||
|
||||
import GoogleIcon from "@mui/icons-material/Google";
|
||||
import DiscordIcon from "../../components/DiscordIcon";
|
||||
import {useSearchParams, Navigate, Link} from "react-router";
|
||||
import MuiLink from "@mui/material/Link";
|
||||
import * as React from "react";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import { useTranslation } from "@refinedev/core";
|
||||
|
||||
export const Login = () => {
|
||||
const { translate } = useTranslation();
|
||||
@@ -35,58 +29,6 @@ export const Login = () => {
|
||||
icon: (<DiscordIcon style={{ fontSize: 24, }} />),
|
||||
},
|
||||
]}
|
||||
forgotPasswordLink={
|
||||
<Stack
|
||||
sx={{
|
||||
direction: "row",
|
||||
display: "flex",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<MuiLink
|
||||
variant="body2"
|
||||
color="primary"
|
||||
fontSize="12px"
|
||||
component={Link}
|
||||
underline="none"
|
||||
to="/auth/forgot-password"
|
||||
>
|
||||
{translate("pages.login.buttons.forgotPassword")}
|
||||
</MuiLink>
|
||||
</Stack>
|
||||
}
|
||||
registerLink={
|
||||
<Box
|
||||
sx={{
|
||||
mt: "24px",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
textAlign="center"
|
||||
variant="body2"
|
||||
component="span"
|
||||
fontSize="12px"
|
||||
>
|
||||
{translate("pages.login.buttons.noAccount")}
|
||||
</Typography>
|
||||
<MuiLink
|
||||
ml="4px"
|
||||
fontSize="12px"
|
||||
variant="body2"
|
||||
color="primary"
|
||||
component={Link}
|
||||
underline="none"
|
||||
to="/auth/register"
|
||||
fontWeight="bold"
|
||||
>
|
||||
{translate("pages.login.signup")}
|
||||
</MuiLink>
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Button } from "@mui/material";
|
||||
import { useLogout } from "@refinedev/core";
|
||||
import { useTranslation } from "@refinedev/core";
|
||||
|
||||
export const Logout = () => {
|
||||
const { translate } = useTranslation();
|
||||
const { mutate: logout } = useLogout();
|
||||
|
||||
return <Button onClick={() => logout()} >Logout</Button>;
|
||||
return <Button onClick={() => logout()} >{ translate("buttons.logout") }</Button>;
|
||||
};
|
||||
|
||||
@@ -1,51 +1,5 @@
|
||||
import { AuthPage } from "@refinedev/mui";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import MuiLink from "@mui/material/Link";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "@refinedev/core";
|
||||
import { Link } from "react-router";
|
||||
|
||||
export const Register = () => {
|
||||
const { translate } = useTranslation();
|
||||
const loginLink = (
|
||||
<Box
|
||||
display="flex"
|
||||
justifyContent="flex-end"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
mt: "24px",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography variant="body2" component="span" fontSize="12px">
|
||||
{translate(
|
||||
"pages.register.buttons.haveAccount",
|
||||
translate(
|
||||
"pages.login.buttons.haveAccount",
|
||||
"Have an account?",
|
||||
),
|
||||
)}
|
||||
</Typography>
|
||||
<MuiLink
|
||||
ml="4px"
|
||||
variant="body2"
|
||||
color="primary"
|
||||
component={Link}
|
||||
underline="none"
|
||||
to="/auth/login"
|
||||
fontSize="12px"
|
||||
fontWeight="bold"
|
||||
>
|
||||
{translate(
|
||||
"pages.register.signin",
|
||||
translate("pages.login.signin", "Sign in"),
|
||||
)}
|
||||
</MuiLink>
|
||||
</Box>
|
||||
)
|
||||
|
||||
return <AuthPage type="register" loginLink={loginLink}/>;
|
||||
return <AuthPage type="register" />;
|
||||
};
|
||||
|
||||
@@ -131,7 +131,7 @@ export const Header: React.FC<RefineThemedLayoutV2HeaderProps> = ({
|
||||
</Stack>
|
||||
)}
|
||||
{!user && (
|
||||
<Link to="/auth/login"><Button>Login</Button></Link>
|
||||
<Link to="/login"><Button>Login</Button></Link>
|
||||
)}
|
||||
<I18nPicker />
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user