fix build error & improve navigateToPreviousUrl method

pull/16592/head
Masum ULU 2 years ago
parent b44301bd65
commit 85d244d44a

@ -6,6 +6,7 @@
},
"allowedNonPeerDependencies": [
"@abp/ng.theme.shared",
"@abp/ng.permission-management"
"@abp/ng.permission-management",
"@abp/ng.components"
]
}

@ -33,11 +33,8 @@ export abstract class AuthFlowStrategy {
protected router: Router;
abstract checkIfInternalAuth(queryParams?: Params): boolean;
abstract navigateToLogin(queryParams?: Params): void;
abstract logout(queryParams?: Params): Observable<any>;
abstract login(params?: LoginParams | Params): Observable<any>;
private catchError = (err: HttpErrorResponse) => {
@ -84,26 +81,29 @@ export abstract class AuthFlowStrategy {
.catch(this.catchError);
}
protected navigateToPreviousUrl() {
this.oAuthService.events
.pipe(
filter(event => event.type === 'token_received' && !!this.oAuthService.state),
map(() => {
const redirect_uri = decodeURIComponent(this.oAuthService.state);
if (redirect_uri && redirect_uri !== '/') {
return redirect_uri;
}
return '/';
}),
switchMap(redirectUri =>
this.configState.getOne$('currentUser').pipe(
filter(user => Boolean(user?.isAuthenticated)),
tap(() => this.router.navigate([redirectUri])),
protected navigateToPreviousUrl(): void {
const { responseType } = this.oAuthConfig;
if (responseType === 'code') {
this.oAuthService.events
.pipe(
filter(event => event.type === 'token_received' && !!this.oAuthService.state),
map(() => {
const redirect_uri = decodeURIComponent(this.oAuthService.state);
if (redirect_uri && redirect_uri !== '/') {
return redirect_uri;
}
return '/';
}),
switchMap(redirectUri =>
this.configState.getOne$('currentUser').pipe(
filter(user => Boolean(user?.isAuthenticated)),
tap(() => this.router.navigate([redirectUri])),
),
),
),
)
.subscribe();
)
.subscribe();
}
}
protected refreshToken() {

Loading…
Cancel
Save