async function supabaseDeleteAccount(session: AuthSession) {
// set loading true
setSupabaseAuthLoading(true);
try {
"use server";
const { error } = await supabaseServer.auth.admin.deleteUser(session.user.id);
if (error) throw error;
navigate("/", { replace: true });
} catch (error: any) {
// log the error and set the error state
console.log(error.message);
setSupabaseError(error.message);
} finally {
// set loading false
setSupabaseAuthLoading(false);
}
}
async function supabaseDeleteAccount(session: AuthSession) {
// set loading true
setSupabaseAuthLoading(true);
try {
"use server";
const { error } = await supabaseServer.auth.admin.deleteUser(session.user.id);
if (error) throw error;
navigate("/", { replace: true });
} catch (error: any) {
// log the error and set the error state
console.log(error.message);
setSupabaseError(error.message);
} finally {
// set loading false
setSupabaseAuthLoading(false);
}
}