Fix auth action return types
The authActions functions (signIn, signOut, resetPassword) were returning a promise with an object containing an error property. The AuthContextType expected these functions to return a promise that resolves to void. This commit updates the return types of these functions to Promise<void> and adjusts the logic to handle errors appropriately without returning them directly in the promise resolution.
This commit is contained in:
@@ -71,7 +71,7 @@ export const signUp = async (email: string, password: string, username: string)
|
||||
}
|
||||
};
|
||||
|
||||
export const signOut = async () => {
|
||||
export const signOut = async (): Promise<void> => {
|
||||
try {
|
||||
const { error } = await supabase.auth.signOut();
|
||||
|
||||
@@ -82,14 +82,12 @@ export const signOut = async () => {
|
||||
description: error.message,
|
||||
variant: 'destructive',
|
||||
});
|
||||
return { error };
|
||||
}
|
||||
|
||||
} else {
|
||||
toast({
|
||||
title: '로그아웃 성공',
|
||||
description: '다음에 또 만나요!',
|
||||
});
|
||||
return { error: null };
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('로그아웃 중 예외 발생:', error);
|
||||
toast({
|
||||
@@ -97,7 +95,6 @@ export const signOut = async () => {
|
||||
description: '예상치 못한 오류가 발생했습니다.',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return { error };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user