Base Template

This commit is contained in:
2022-06-15 15:15:49 +07:00
parent 077e678979
commit f18bb85b94
47 changed files with 2597 additions and 1172 deletions

View File

@@ -39,8 +39,8 @@ export default function LoginForm() {
});
const defaultValues = {
email: '',
password: '',
email: 'admin@linksehat.dev',
password: 'password',
remember: true,
};
@@ -58,15 +58,16 @@ export default function LoginForm() {
const onSubmit = async (data: FormValuesProps) => {
try {
await login(data.email, data.password );
navigate('/dashboard/one');
const loginResult = await login(data.email, data.password );
navigate('/dashboard');
} catch (error) {
console.error(error);
reset();
if (isMountedRef.current) {
setError('afterSubmit', { ...error, message: error.message });
setError('afterSubmit', { ...error, message: error.data.message });
}
}
};
@@ -74,6 +75,7 @@ export default function LoginForm() {
return (
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<Stack spacing={3}>
<Alert severity='info'>Email : admin@linksehat.dev & Password : password</Alert>
{!!errors.afterSubmit && <Alert severity="error">{errors.afterSubmit.message}</Alert>}
<RHFTextField name="email" label="Email address" />