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 {
|
try {
|
||||||
const { error } = await supabase.auth.signOut();
|
const { error } = await supabase.auth.signOut();
|
||||||
|
|
||||||
@@ -82,14 +82,12 @@ export const signOut = async () => {
|
|||||||
description: error.message,
|
description: error.message,
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
});
|
});
|
||||||
return { error };
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: '로그아웃 성공',
|
title: '로그아웃 성공',
|
||||||
description: '다음에 또 만나요!',
|
description: '다음에 또 만나요!',
|
||||||
});
|
});
|
||||||
return { error: null };
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('로그아웃 중 예외 발생:', error);
|
console.error('로그아웃 중 예외 발생:', error);
|
||||||
toast({
|
toast({
|
||||||
@@ -97,7 +95,6 @@ export const signOut = async () => {
|
|||||||
description: '예상치 못한 오류가 발생했습니다.',
|
description: '예상치 못한 오류가 발생했습니다.',
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
});
|
});
|
||||||
return { error };
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user