bugfix : 자동로그인시 오류발생하면 로딩중으로 표시되는 문제 보완
This commit is contained in:
parent
93bcfa9cb7
commit
2ceec93b36
|
@ -87,41 +87,51 @@ import {
|
|||
|
||||
@Injectable()
|
||||
export class Effects {
|
||||
webLogin$ = createEffect(() =>
|
||||
this.actions$.pipe(
|
||||
ofType(webLogin),
|
||||
map(action => action),
|
||||
exhaustMap(
|
||||
(params: {
|
||||
loginInfo: LoginInfo;
|
||||
rememberMe: boolean;
|
||||
autoLogin: boolean;
|
||||
}) =>
|
||||
this.piService
|
||||
.login2({
|
||||
loginId: params.loginInfo.loginId,
|
||||
loginPw: params.loginInfo.loginPw,
|
||||
companyCode: params.loginInfo.companyCode
|
||||
})
|
||||
.pipe(
|
||||
map((res: Login2Response) => {
|
||||
if ('success' !== res.status.toLowerCase()) {
|
||||
this.store.dispatch(increaseLoginFailCount({}));
|
||||
return webLoginFailure({ error: 'Failed' });
|
||||
} else {
|
||||
this.store.dispatch(initialLoginFailCount({}));
|
||||
return webLoginSuccess({
|
||||
loginInfo: params.loginInfo,
|
||||
rememberMe: params.rememberMe,
|
||||
autoLogin: params.autoLogin,
|
||||
login2Response: res
|
||||
});
|
||||
}
|
||||
}),
|
||||
catchError(error => of(webLoginFailure({ error })))
|
||||
)
|
||||
)
|
||||
)
|
||||
webLogin$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType(webLogin),
|
||||
map(action => action),
|
||||
exhaustMap(
|
||||
(params: {
|
||||
loginInfo: LoginInfo;
|
||||
rememberMe: boolean;
|
||||
autoLogin: boolean;
|
||||
}) =>
|
||||
this.piService
|
||||
.login2({
|
||||
loginId: params.loginInfo.loginId,
|
||||
loginPw: params.loginInfo.loginPw,
|
||||
companyCode: params.loginInfo.companyCode
|
||||
})
|
||||
.pipe(
|
||||
map((res: Login2Response) => {
|
||||
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(webLoginFailure({ error: 'Failed' }));
|
||||
}
|
||||
} else {
|
||||
this.store.dispatch(initialLoginFailCount({}));
|
||||
this.store.dispatch(
|
||||
webLoginSuccess({
|
||||
loginInfo: params.loginInfo,
|
||||
rememberMe: params.rememberMe,
|
||||
autoLogin: params.autoLogin,
|
||||
login2Response: res
|
||||
})
|
||||
);
|
||||
}
|
||||
}),
|
||||
catchError(error => of(webLoginFailure({ error })))
|
||||
)
|
||||
)
|
||||
),
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
webLoginSuccess$ = createEffect(
|
||||
|
|
Loading…
Reference in New Issue
Block a user