Skip to content

Commit feecaf1

Browse files
authored
Merge pull request #298 from WeGo-Together/chiyoung-fix/login
fix: router.replace를 window.location.href로 변경 시 정상동작하는 지 테스트
2 parents 2563854 + 60f9bcc commit feecaf1

File tree

1 file changed

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

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ 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);
@@ -75,9 +75,7 @@ export const useLogin = () => {
7575
setIsAuthenticated(true);
7676

7777
const nextPath = normalizePath(searchParams.get('path'));
78-
setTimeout(() => {
79-
router.replace(nextPath);
80-
}, 0);
78+
window.location.href = nextPath;
8179
} catch (error) {
8280
if (isCommonErrorResponse(error)) {
8381
console.error('[LOGIN ERROR]', error.errorCode, error.detail);

0 commit comments

Comments
 (0)