import { useState } from 'react'; import { supabase } from '../utils/initSupabase'; export default function SupabaseAuth() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const handleLogin = async (type, email, password) => { const { error, user } = type === 'LOGIN' ? await supabase.auth.signIn({ email, password }) : await supabase.auth.signUp({ email, password }); if (!error && !user) alert('Check your email for the login link!'); if (error) alert(error.message); }; async function handleOAuthLogin(provider) { let { error } = await supabase.auth.signIn({ provider }); if (error) alert(error.message); } async function forgotPassword() { const email = prompt('Please enter your email:'); if (email === null || email === '') return alert('You must enter your email.'); const { error } = await supabase.auth.api.resetPasswordForEmail(email); if (error) return alert(error.message); alert('Password recovery email has been sent.'); } return (