Cleaning up

This commit is contained in:
2025-05-15 16:53:21 -05:00
parent 5dcf2ed423
commit 40ab2d8450
10 changed files with 61 additions and 286 deletions

View File

@ -32,7 +32,7 @@ export const signUp = async (formData: FormData) => {
});
if (error) {
return redirect('/protected');
return redirect('/');
//return encodedRedirect('error', '/sign-up',
//'Thanks for signing up! Please check your email for a verification link.');
} else {
@ -49,8 +49,8 @@ export const signUp = async (formData: FormData) => {
} catch (error) {
console.error('Error updating profile: ', error);
} finally {
return redirect('/protected');
//return encodedRedirect('success', '/protected',
return redirect('/');
//return encodedRedirect('success', '/',
//'Thanks for signing up! Please check your email for a verification link.);
}
}
@ -69,7 +69,7 @@ export const signIn = async (formData: FormData) => {
if (error) {
return encodedRedirect('error', '/sign-in', error.message);
}
return redirect('/protected');
return redirect('/');
};
export const forgotPassword = async (formData: FormData) => {
@ -83,7 +83,7 @@ export const forgotPassword = async (formData: FormData) => {
}
const { error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: `${origin}/auth/callback?redirect_to=/protected/reset-password`,
redirectTo: `${origin}/auth/callback?redirect_to=/reset-password`,
});
if (error) {
@ -113,7 +113,7 @@ export const resetPassword = async (formData: FormData) => {
if (!password || !confirmPassword) {
encodedRedirect(
'error',
'/protected/reset-password',
'/reset-password',
'Password and confirm password are required',
);
}
@ -121,7 +121,7 @@ export const resetPassword = async (formData: FormData) => {
if (password !== confirmPassword) {
encodedRedirect(
'error',
'/protected/reset-password',
'/reset-password',
'Passwords do not match',
);
}
@ -133,12 +133,12 @@ export const resetPassword = async (formData: FormData) => {
if (error) {
encodedRedirect(
'error',
'/protected/reset-password',
'/reset-password',
'Password update failed',
);
}
encodedRedirect('success', '/protected/reset-password', 'Password updated');
encodedRedirect('success', '/reset-password', 'Password updated');
};
export const signOut = async () => {