bugfix : 자동로그인시 오류발생하면 로딩중으로 표시되는 문제 보완

This commit is contained in:
leejinho 2020-03-18 10:28:08 +09:00
parent 93bcfa9cb7
commit 2ceec93b36

View File

@ -87,7 +87,8 @@ import {
@Injectable() @Injectable()
export class Effects { export class Effects {
webLogin$ = createEffect(() => webLogin$ = createEffect(
() =>
this.actions$.pipe( this.actions$.pipe(
ofType(webLogin), ofType(webLogin),
map(action => action), map(action => action),
@ -106,22 +107,31 @@ export class Effects {
.pipe( .pipe(
map((res: Login2Response) => { map((res: Login2Response) => {
if ('success' !== res.status.toLowerCase()) { if ('success' !== res.status.toLowerCase()) {
if (!!params.autoLogin) {
// auto login Failure.
this.localStorageService.remove(KEY_APP_USER_INFO);
this.router.navigateByUrl('/account/login');
} else {
this.store.dispatch(increaseLoginFailCount({})); this.store.dispatch(increaseLoginFailCount({}));
return webLoginFailure({ error: 'Failed' }); this.store.dispatch(webLoginFailure({ error: 'Failed' }));
}
} else { } else {
this.store.dispatch(initialLoginFailCount({})); this.store.dispatch(initialLoginFailCount({}));
return webLoginSuccess({ this.store.dispatch(
webLoginSuccess({
loginInfo: params.loginInfo, loginInfo: params.loginInfo,
rememberMe: params.rememberMe, rememberMe: params.rememberMe,
autoLogin: params.autoLogin, autoLogin: params.autoLogin,
login2Response: res login2Response: res
}); })
);
} }
}), }),
catchError(error => of(webLoginFailure({ error }))) catchError(error => of(webLoginFailure({ error })))
) )
) )
) ),
{ dispatch: false }
); );
webLoginSuccess$ = createEffect( webLoginSuccess$ = createEffect(