// @ts-nocheck
import React from 'react';
import { Formik } from 'formik';
import { Link } from 'react-router-dom';
import { AppToaster as Toaster, FormattedMessage as T } from '@/components';
import AuthInsider from '@/containers/Authentication/AuthInsider';
import { useAuthLogin } from '@/hooks/query';
import LoginForm from './LoginForm';
import { LoginSchema, transformLoginErrorsToToasts } from './utils';
import {
AuthFooterLinks,
AuthFooterLink,
AuthInsiderCard,
} from './_components';
import { useAuthMetaBoot } from './AuthMetaBoot';
const initialValues = {
crediential: '',
password: '',
keepLoggedIn: false,
};
/**
* Login page.
*/
export default function Login() {
const { mutateAsync: loginMutate } = useAuthLogin();
const handleSubmit = (values, { setSubmitting }) => {
loginMutate({
crediential: values.crediential,
password: values.password,
}).catch(
({
response: {
data: { errors },
},
}) => {
const toastBuilders = transformLoginErrorsToToasts(errors);
toastBuilders.forEach((builder) => {
Toaster.show(builder);
});
setSubmitting(false);
},
);
};
return (
);
}
function LoginFooterLinks() {
const { signupDisabled } = useAuthMetaBoot();
return (
{!signupDisabled && (
Don't have an account? Sign up
)}
);
}