'use client';
import { useFormState, useFormStatus } from 'react-dom';
import { login } from '@/lib/auth-actions';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Loader2 } from 'lucide-react';
import { useEffect } from 'react';
import { useToast } from '@/hooks/use-toast';
import { Logo } from '@/components/icons';
const initialState = {
message: '',
};
function SubmitButton() {
const { pending } = useFormStatus();
return (
);
}
export default function LoginPage() {
const [state, formAction] = useFormState(login, initialState);
const { toast } = useToast();
useEffect(() => {
if (state?.message) {
toast({
title: 'Login Failed',
description: state.message,
variant: 'destructive',
});
}
}, [state, toast]);
return (
PromptVerse
Welcome Back
Enter your password to access your prompts.
);
}