mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge pull request #4519 from atmire/accessibility-settings-7_x
[Port dspace-7_x] Accessibility settings page SSR Fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit, Optional } from '@angular/core';
|
||||
import { AuthService } from '../../core/auth/auth.service';
|
||||
import {
|
||||
AccessibilitySetting,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import { BehaviorSubject, distinctUntilChanged, map, Subscription, take } from 'rxjs';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { isEmpty } from 'src/app/shared/empty.util';
|
||||
import { hasValue, isEmpty } from 'src/app/shared/empty.util';
|
||||
import { AlertType } from '../../shared/alert/alert-type';
|
||||
import { KlaroService } from '../../shared/cookies/klaro.service';
|
||||
|
||||
@@ -35,7 +35,7 @@ export class AccessibilitySettingsComponent implements OnInit, OnDestroy {
|
||||
protected settingsService: AccessibilitySettingsService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected translateService: TranslateService,
|
||||
protected klaroService: KlaroService,
|
||||
@Optional() protected klaroService: KlaroService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -45,11 +45,19 @@ export class AccessibilitySettingsComponent implements OnInit, OnDestroy {
|
||||
this.subscriptions.push(
|
||||
this.authService.isAuthenticated().pipe(distinctUntilChanged())
|
||||
.subscribe(val => this.isAuthenticated.next(val)),
|
||||
this.klaroService.getSavedPreferences().pipe(
|
||||
map(preferences => preferences?.accessibility === true),
|
||||
distinctUntilChanged(),
|
||||
).subscribe(val => this.cookieIsAccepted.next(val)),
|
||||
);
|
||||
|
||||
if (hasValue(this.klaroService)) {
|
||||
this.subscriptions.push(
|
||||
this.klaroService.getSavedPreferences().pipe(
|
||||
map(preferences => preferences?.accessibility === true),
|
||||
distinctUntilChanged(),
|
||||
).subscribe(val => this.cookieIsAccepted.next(val))
|
||||
);
|
||||
} else {
|
||||
this.cookieIsAccepted.next(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
Reference in New Issue
Block a user