import React from 'react'; import './LoginForm.scss'; import Area from '@components/common/Area.js'; import { EmailField } from '@components/common/form/EmailField.js'; import { Form, useFormContext } from '@components/common/form/Form.js'; import { PasswordField } from '@components/common/form/PasswordField.js'; import { Button } from '@components/common/ui/Button.js'; import { LockKeyhole, Mail } from 'lucide-react'; interface LoginFormProps { authUrl: string; dashboardUrl: string; } const SubmitButton: React.FC = () => { const { formState: { isSubmitting } } = useFormContext(); return (
); }; export default function LoginForm({ authUrl, dashboardUrl }: LoginFormProps) { const [error, setError] = React.useState(null); const onSuccess = (response) => { if (!response.error) { window.location.href = dashboardUrl; } else { setError(response.error.message); } }; return (
{error &&
{error}
}
} label="Email" name="email" placeholder="Email" required validation={{ required: 'Email is required' }} /> ) }, sortOrder: 10 }, { component: { default: ( } label="Password" name="password" placeholder="Password" required validation={{ required: 'Password is required' }} showToggle /> ) }, sortOrder: 20 }, { component: { default: }, sortOrder: 30 } ]} />
); } export const layout = { areaId: 'content', sortOrder: 10 }; export const query = ` query Query { authUrl: url(routeId: "adminLoginJson") dashboardUrl: url(routeId: "dashboard") } `;