|
1 | | -import { Inject, Injectable } from '@angular/core'; |
| 1 | +import { Inject, Injectable, Optional } from '@angular/core'; |
2 | 2 | import { Observable, of, switchMap, combineLatest } from 'rxjs'; |
3 | 3 | import { map, take } from 'rxjs/operators'; |
4 | 4 | import { CookieService } from '../core/services/cookie.service'; |
@@ -69,7 +69,7 @@ export class AccessibilitySettingsService { |
69 | 69 | protected cookieService: CookieService, |
70 | 70 | protected authService: AuthService, |
71 | 71 | protected ePersonService: EPersonDataService, |
72 | | - protected klaroService: KlaroService, |
| 72 | + @Optional() protected klaroService: KlaroService, |
73 | 73 | @Inject(APP_CONFIG) protected appConfig: AppConfig, |
74 | 74 | ) { |
75 | 75 | } |
@@ -223,6 +223,10 @@ export class AccessibilitySettingsService { |
223 | 223 | * Emits 'failed' when setting in a cookie failed due to the cookie not being accepted, 'cookie' when it succeeded. |
224 | 224 | */ |
225 | 225 | setSettingsInCookie(settings: AccessibilitySettings): Observable<'cookie' | 'failed'> { |
| 226 | + if (hasNoValue(this.klaroService)) { |
| 227 | + return of('failed'); |
| 228 | + } |
| 229 | + |
226 | 230 | return this.klaroService.getSavedPreferences().pipe( |
227 | 231 | map(preferences => preferences.accessibility), |
228 | 232 | map((accessibilityCookieAccepted: boolean) => { |
|
0 commit comments