Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPF-237 - redirects in auth-guard according to platformIsLive #169

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/app/core/route/guard/auth-guard.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Injectable } from '@angular/core';
import { of as observableOf, Observable } from 'rxjs';
import { of as observableOf } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import {
ActivatedRouteSnapshot,
CanActivate,
RouterStateSnapshot,
} from '@angular/router';
import { CanActivate } from '@angular/router';
import { UserService } from '../../user/services/user.service';
import { environment } from '../../../../environments/environment';

Expand All @@ -30,11 +26,15 @@
return true;
},
() => {
window.location.href = environment.projectaanvraagDashboardUrl;
window.location.href = environment.platformIsLive
? environment.platformUrl
: environment.projectaanvraagDashboardUrl;
}
),
catchError((error) => {

Check warning on line 34 in src/app/core/route/guard/auth-guard.service.ts

View workflow job for this annotation

GitHub Actions / lint

'error' is defined but never used
window.location.href = environment.projectaanvraagDashboardUrl;
window.location.href = environment.platformIsLive
? environment.platformUrl
: environment.projectaanvraagDashboardUrl;
return observableOf(false);
})
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/topbar/components/topbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
<button class="btn btn-outline-secondary" ngbDropdownToggle>
<span class="hidden-lg-down"> {{ user.displayName }}</span>
</button>
<div ngbDropdownMenu class="dropdown-menu dropdown-menu-right">
<div
LucWollants marked this conversation as resolved.
Show resolved Hide resolved
*ngIf="!platformIsLive"
ngbDropdownMenu
class="dropdown-menu dropdown-menu-right"
>
<button ngbDropdownItem class="dropdown-item" (click)="logout()">
{{ 'TOPBAR_USER_MENU_BUTTON_LOGOUT' | translate }}
</button>
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/topbar/components/topbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export class TopbarComponent implements OnInit, OnDestroy {
*/
private dynamicComponentSubscriptions: any = {};

private platformIsLive: boolean = environment.platformIsLive;

/**
* TopbarComponent constructor
* @param userService
Expand Down
Loading