import { useState } from 'react' import { supabase } from '../lib/supabase' interface LoginProps { onLoginSuccess: () => void } export function Login({ onLoginSuccess }: LoginProps) { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const handleLogin = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) setError(null) try { const { data, error } = await supabase.auth.signInWithPassword({ email, password, }) if (error) { setError(error.message) } else if (data.user) { onLoginSuccess() } } catch (err) { setError('An unexpected error occurred') console.error('Login error:', err) } finally { setLoading(false) } } return (

Sign in to your account

RBAC Authentication System

setEmail(e.target.value)} />
setPassword(e.target.value)} />
{error && (
{error}
)}
) }