diff --git a/libs/services/src/lib/epg.service.ts b/libs/services/src/lib/epg.service.ts index dff774921..a00c48c10 100644 --- a/libs/services/src/lib/epg.service.ts +++ b/libs/services/src/lib/epg.service.ts @@ -14,6 +14,8 @@ import { EpgProgram } from 'shared-interfaces'; export class EpgService { private snackBar = inject(MatSnackBar); private translate = inject(TranslateService); + + // TODO: do not use store directly in the service private store = inject(Store); private epgAvailable = new BehaviorSubject(false); @@ -77,15 +79,11 @@ export class EpgService { }) ) .subscribe((programs) => { - if (programs.length === 0) { - this.store.dispatch( - PlaylistActions.setEpgAvailableFlag({ value: false }) - ); - } else { - this.store.dispatch( - PlaylistActions.setEpgAvailableFlag({ value: true }) - ); - } + this.store.dispatch( + PlaylistActions.setEpgAvailableFlag({ + value: programs.length === 0 ? false : true, + }) + ); this.currentEpgPrograms.next(programs); console.log('Updated programs:', programs); // Debug log });