Fix TS2339 error in useLogin

The property 'user' might not exist on the returned object from signIn.
Handle the case where user is undefined.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 13:07:14 +00:00
parent a8537d5398
commit 8931ee4bb6
3 changed files with 15 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ export function useLogin() {
description: errorMessage,
variant: "destructive"
});
} else {
} else if (user) {
// 로그인 성공 시 필요한 테이블 설정
try {
setIsSettingUpTables(true);
@@ -80,6 +80,15 @@ export function useLogin() {
setIsSettingUpTables(false);
}
navigate("/");
} else {
// user가 없지만 error도 없는 경우 (드문 경우)
console.warn("로그인 성공했지만 사용자 정보가 없습니다.");
toast({
title: "로그인 상태 확인 중",
description: "로그인은 성공했지만 사용자 정보를 확인하지 못했습니다. 페이지를 새로고침해보세요.",
variant: "default"
});
navigate("/");
}
} catch (err: any) {