Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
27 lines
624 B
TypeScript
27 lines
624 B
TypeScript
import type { FC } from "react";
|
|
|
|
import { useLocation, useNavigate } from "react-router";
|
|
|
|
import { useAuth } from "../model/auth-context";
|
|
import { AuthForm } from "./AuthForm/AuthForm";
|
|
|
|
const RegisterForm: FC = () => {
|
|
const { register } = useAuth();
|
|
const navigate = useNavigate();
|
|
const location = useLocation();
|
|
const returnTo
|
|
= (location.state as null | { returnTo?: string })?.returnTo ?? "/accounts";
|
|
|
|
return (
|
|
<AuthForm
|
|
onSubmit={async (email, password) => {
|
|
await register(email, password);
|
|
await navigate(returnTo, { replace: true });
|
|
}}
|
|
register
|
|
/>
|
|
);
|
|
};
|
|
|
|
export { RegisterForm };
|