Skip to content

Commit

Permalink
feat(auth): add conditional display of actions in terms acceptance
Browse files Browse the repository at this point in the history
  • Loading branch information
frontend-specialisten committed Oct 25, 2024
1 parent b382d62 commit b392cf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions libs/eo/auth/data-access/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion libs/eo/auth/feature-terms/terms.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const selector = 'eo-auth-terms';
<div [innerHtml]="terms()"></div>
</eo-scroll-view>
@if (isLoggedIn) {
@if (isLoggedIn && showActions) {
<div class="actions">
<div class="watt-space-stack-m">
<watt-checkbox [(ngModel)]="hasAcceptedTerms" [disabled]="loadingTermsFailed">
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit b392cf8

Please sign in to comment.