Ran prettier. Moved Header to layout file

This commit is contained in:
2025-03-19 15:52:55 -05:00
parent f5e3cb6234
commit 939fd796ee
27 changed files with 482 additions and 447 deletions

View File

@ -1,32 +1,33 @@
'use server'
'use server';
import 'server-only';
import { revalidatePath } from 'next/cache'
import { redirect } from 'next/navigation'
import { revalidatePath } from 'next/cache';
import { redirect } from 'next/navigation';
import { createClient } from '@/utils/supabase/server'
import { createClient } from '@/utils/supabase/server';
export const login = async (formData: FormData) => {
const supabase = await createClient()
const supabase = await createClient();
// type-casting here for convenience
// in practice, you should validate your inputs
const data = {
email: formData.get('email') as string,
password: formData.get('password') as string,
}
};
const { error } = await supabase.auth.signInWithPassword(data)
const { error } = await supabase.auth.signInWithPassword(data);
if (error) {
redirect('/error')
redirect('/error');
}
revalidatePath('/', 'layout')
revalidatePath('/', 'layout');
redirect('/');
};
export const signup = async (formData: FormData) => {
const supabase = await createClient()
const supabase = await createClient();
// type-casting here for convenience
// in practice, you should validate your inputs
@ -34,13 +35,14 @@ export const signup = async (formData: FormData) => {
fullName: formData.get('fullName') as string,
email: formData.get('email') as string,
password: formData.get('password') as string,
}
};
const { error } = await supabase.auth.signUp(data)
const { error } = await supabase.auth.signUp(data);
if (error) {
redirect('/error')
redirect('/error');
}
revalidatePath('/', 'layout')
revalidatePath('/', 'layout');
redirect('/');
};