Skip to content

Commit 122d31b

Browse files
committed
119602: Make KlaroService optional in AccSettingsService
1 parent 7ab598d commit 122d31b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/app/accessibility/accessibility-settings.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Inject, Injectable } from '@angular/core';
1+
import { Inject, Injectable, Optional } from '@angular/core';
22
import { Observable, of, switchMap, combineLatest } from 'rxjs';
33
import { map, take } from 'rxjs/operators';
44
import { CookieService } from '../core/services/cookie.service';
@@ -69,7 +69,7 @@ export class AccessibilitySettingsService {
6969
protected cookieService: CookieService,
7070
protected authService: AuthService,
7171
protected ePersonService: EPersonDataService,
72-
protected klaroService: KlaroService,
72+
@Optional() protected klaroService: KlaroService,
7373
@Inject(APP_CONFIG) protected appConfig: AppConfig,
7474
) {
7575
}
@@ -223,6 +223,10 @@ export class AccessibilitySettingsService {
223223
* Emits 'failed' when setting in a cookie failed due to the cookie not being accepted, 'cookie' when it succeeded.
224224
*/
225225
setSettingsInCookie(settings: AccessibilitySettings): Observable<'cookie' | 'failed'> {
226+
if (hasNoValue(this.klaroService)) {
227+
return of('failed');
228+
}
229+
226230
return this.klaroService.getSavedPreferences().pipe(
227231
map(preferences => preferences.accessibility),
228232
map((accessibilityCookieAccepted: boolean) => {

0 commit comments

Comments
 (0)