/
index.tsx
41 lines (35 loc) · 1.17 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";
import { AuthPageProps } from "@refinedev/core";
import { BoxProps, CardProps } from "@mantine/core";
import { UseFormInput } from "@mantine/form/lib/types";
import {
LoginPage,
RegisterPage,
ForgotPasswordPage,
UpdatePasswordPage,
} from "./components";
export type FormPropsType = UseFormInput<unknown> & {
onSubmit?: (values: any) => void;
};
export type AuthProps = AuthPageProps<BoxProps, CardProps, FormPropsType>;
/**
* **refine** has a default auth page form served on the `/login` route when the `authProvider` configuration is provided.
* @param title is not implemented yet.
* @see {@link https://refine.dev/docs/api-reference/mantine/components/mantine-auth-page/} for more details.
*/
export const AuthPage: React.FC<AuthProps> = (props) => {
const { type } = props;
const renderView = () => {
switch (type) {
case "register":
return <RegisterPage {...props} />;
case "forgotPassword":
return <ForgotPasswordPage {...props} />;
case "updatePassword":
return <UpdatePasswordPage {...props} />;
default:
return <LoginPage {...props} />;
}
};
return <>{renderView()}</>;
};