|
|
|
@ -22,7 +22,7 @@ import { Observable, of, ReplaySubject, throwError } from 'rxjs'; |
|
|
|
import { catchError, map, mergeMap, tap } from 'rxjs/operators'; |
|
|
|
|
|
|
|
import { LoginRequest, LoginResponse, PublicLoginRequest } from '@shared/models/login.models'; |
|
|
|
import { ActivatedRoute, Router, UrlTree } from '@angular/router'; |
|
|
|
import { Router, UrlTree } from '@angular/router'; |
|
|
|
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from '../http/http-utils'; |
|
|
|
import { UserService } from '../http/user.service'; |
|
|
|
import { Store } from '@ngrx/store'; |
|
|
|
@ -35,7 +35,6 @@ import { |
|
|
|
} from './auth.actions'; |
|
|
|
import { getCurrentAuthState, getCurrentAuthUser } from './auth.selectors'; |
|
|
|
import { Authority } from '@shared/models/authority.enum'; |
|
|
|
import { ActionSettingsChangeLanguage } from '@app/core/settings/settings.actions'; |
|
|
|
import { AuthPayload, AuthState, SysParams, SysParamsState } from '@core/auth/auth.models'; |
|
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
import { AuthUser } from '@shared/models/user.model'; |
|
|
|
@ -59,7 +58,6 @@ export class AuthService { |
|
|
|
private userService: UserService, |
|
|
|
private timeService: TimeService, |
|
|
|
private router: Router, |
|
|
|
private route: ActivatedRoute, |
|
|
|
private zone: NgZone, |
|
|
|
private utils: UtilsService, |
|
|
|
private translate: TranslateService, |
|
|
|
@ -419,14 +417,7 @@ export class AuthService { |
|
|
|
this.loadSystemParams().subscribe( |
|
|
|
(sysParams) => { |
|
|
|
authPayload = {...authPayload, ...sysParams}; |
|
|
|
let userLang; |
|
|
|
if (authPayload.userDetails.additionalInfo && authPayload.userDetails.additionalInfo.lang) { |
|
|
|
userLang = authPayload.userDetails.additionalInfo.lang; |
|
|
|
} else { |
|
|
|
userLang = null; |
|
|
|
} |
|
|
|
loadUserSubject.next(authPayload); |
|
|
|
this.notifyUserLang(userLang); |
|
|
|
loadUserSubject.complete(); |
|
|
|
}, |
|
|
|
(err) => { |
|
|
|
@ -607,10 +598,6 @@ export class AuthService { |
|
|
|
this.store.dispatch(new ActionAuthAuthenticated(authPayload)); |
|
|
|
} |
|
|
|
|
|
|
|
private notifyUserLang(userLang: string) { |
|
|
|
this.store.dispatch(new ActionSettingsChangeLanguage({userLang})); |
|
|
|
} |
|
|
|
|
|
|
|
private updateAndValidateToken(token, prefix, notify) { |
|
|
|
let valid = false; |
|
|
|
const tokenData = this.jwtHelper.decodeToken(token); |
|
|
|
|