feat: add authorization
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
import { Stack, Title } from "@mantine/core";
|
||||
import { Paper, Stack, Title } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LoginForm } from "../../../features/auth";
|
||||
import { StateView } from "../../../shared/ui/StateView";
|
||||
|
||||
export function LoginPage() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Stack>
|
||||
<Title order={1}>{t("auth.login")}</Title>
|
||||
<LoginPageEmpty />
|
||||
</Stack>
|
||||
<main className="auth-page">
|
||||
<Paper className="auth-card" p="xl" radius="lg" withBorder>
|
||||
<Stack gap="lg">
|
||||
<Title order={1}>{t("auth.login")}</Title>
|
||||
<LoginForm />
|
||||
</Stack>
|
||||
</Paper>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import { Stack, Title } from "@mantine/core";
|
||||
import { Paper, Stack, Title } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { RegisterForm } from "../../../features/auth";
|
||||
import { StateView } from "../../../shared/ui/StateView";
|
||||
|
||||
export function RegisterPage() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Stack>
|
||||
<Title order={1}>{t("auth.register")}</Title>
|
||||
<RegisterPageEmpty />
|
||||
</Stack>
|
||||
<main className="auth-page">
|
||||
<Paper className="auth-card" p="xl" radius="lg" withBorder>
|
||||
<Stack gap="lg">
|
||||
<Title order={1}>{t("auth.register")}</Title>
|
||||
<RegisterForm />
|
||||
</Stack>
|
||||
</Paper>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
import { Stack, Title } from "@mantine/core";
|
||||
import { Button, Stack, Title } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate } from "react-router";
|
||||
import { useAuth } from "../../../features/auth";
|
||||
import { StateView } from "../../../shared/ui/StateView";
|
||||
|
||||
export function SettingsPage() {
|
||||
const { t } = useTranslation();
|
||||
const { logout } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<Stack>
|
||||
<Title order={1}>{t("settings.title")}</Title>
|
||||
<SettingsPageEmpty />
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await logout();
|
||||
navigate("/login", { replace: true });
|
||||
}}
|
||||
>
|
||||
{t("auth.logout")}
|
||||
</Button>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user