Skip to content

Commit 6bd6970

Browse files
committed
fix: setIsAuthenticated 구문을 제거하면 router.replace가 정상 동작하는지 테스트
1 parent feecaf1 commit 6bd6970

File tree

1 file changed

+5
-4
lines changed
  • src/hooks/use-auth/use-auth-login

1 file changed

+5
-4
lines changed

src/hooks/use-auth/use-auth-login/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ const isCommonErrorResponse = (e: unknown): e is CommonErrorResponse => {
4848
};
4949

5050
export const useLogin = () => {
51-
const _router = useRouter();
51+
const router = useRouter();
5252
const searchParams = useSearchParams();
5353

5454
const [loginError, setLoginError] = useState<string | null>(null);
5555
const clearLoginError = useCallback(() => setLoginError(null), []);
5656

57-
const { setIsAuthenticated } = useAuth();
57+
const { setIsAuthenticated: _ } = useAuth();
5858

5959
const handleLogin = async (payload: LoginRequest, formApi: { reset: () => void }) => {
6060
setLoginError(null);
@@ -72,10 +72,11 @@ export const useLogin = () => {
7272

7373
formApi.reset();
7474

75-
setIsAuthenticated(true);
75+
// setIsAuthenticated(true);
7676

7777
const nextPath = normalizePath(searchParams.get('path'));
78-
window.location.href = nextPath;
78+
// window.location.href = nextPath;
79+
router.replace(nextPath);
7980
} catch (error) {
8081
if (isCommonErrorResponse(error)) {
8182
console.error('[LOGIN ERROR]', error.errorCode, error.detail);

0 commit comments

Comments
 (0)