Skip to content

Commit 2563854

Browse files
authored
Merge pull request #297 from WeGo-Together/chiyoung-fix/login
[Fix] router.replace 를 setTimeout으로 감쌀 경우 정상 동작 되는지 테스트
2 parents 915a16a + 9f8acb0 commit 2563854

File tree

1 file changed

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

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const useLogin = () => {
5656

5757
const { setIsAuthenticated } = useAuth();
5858

59-
const handleLogin = async (payload: LoginRequest, _formApi: { reset: () => void }) => {
59+
const handleLogin = async (payload: LoginRequest, formApi: { reset: () => void }) => {
6060
setLoginError(null);
6161

6262
try {
@@ -70,12 +70,14 @@ export const useLogin = () => {
7070
secure: process.env.NODE_ENV === 'production',
7171
});
7272

73-
// formApi.reset();
73+
formApi.reset();
7474

7575
setIsAuthenticated(true);
7676

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

0 commit comments

Comments
 (0)