From b392cf8698f6fbb0075fd3c3a28c41ee5200e686 Mon Sep 17 00:00:00 2001 From: Alexander Hafstad Date: Fri, 25 Oct 2024 11:14:01 +0200 Subject: [PATCH] feat(auth): add conditional display of actions in terms acceptance --- libs/eo/auth/data-access/auth.guard.ts | 3 +++ libs/eo/auth/feature-terms/terms.component.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/eo/auth/data-access/auth.guard.ts b/libs/eo/auth/data-access/auth.guard.ts index 67651f904c..adb608ac98 100644 --- a/libs/eo/auth/data-access/auth.guard.ts +++ b/libs/eo/auth/data-access/auth.guard.ts @@ -45,6 +45,9 @@ export const eoScopeGuard: CanActivateFn = async (route: ActivatedRouteSnapshot) if (!authService.user()?.profile.tos_accepted) { router.navigate([transloco.getActiveLang(), 'terms'], { queryParams: { redirectUrl }, + state: { + 'show-actions': true + } }); return false; } else { diff --git a/libs/eo/auth/feature-terms/terms.component.ts b/libs/eo/auth/feature-terms/terms.component.ts index 3cfbd5325b..e9db09ffda 100644 --- a/libs/eo/auth/feature-terms/terms.component.ts +++ b/libs/eo/auth/feature-terms/terms.component.ts @@ -189,7 +189,7 @@ const selector = 'eo-auth-terms';
- @if (isLoggedIn) { + @if (isLoggedIn && showActions) {
@@ -228,6 +228,7 @@ export class EoTermsComponent { private sanitizer = inject(DomSanitizer); private toastService: WattToastService = inject(WattToastService); + showActions = this.router.getCurrentNavigation()?.extras.state?.['show-actions']; language = this.transloco.getActiveLang(); translations = translations; isLoggedIn = !!this.authService.user();