// components/auth/login-form.tsx 'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import Link from 'next/link' import { createClient } from '@/lib/supabase/client' export function LoginForm() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState(null) const [loading, setLoading] = useState(false) const router = useRouter() async function handleSubmit(e: React.FormEvent) { e.preventDefault() setLoading(true) setError(null) const supabase = createClient() const { error } = await supabase.auth.signInWithPassword({ email, password }) if (error) { setError(error.message) setLoading(false) return } router.refresh() } return (

IMS

HSE Incident Management

{error && (

{error}

)} setEmail(e.target.value)} required autoComplete="email" className="border rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500" /> setPassword(e.target.value)} required autoComplete="current-password" className="border rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500" />

Forgot password?

) }