mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
refactor(epg): simplify EPG availability dispatch
This commit is contained in:
1 parent
7c42c1b6fc
commit
e04cb113dd
1 file changed
+7
-9
@@ -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<boolean>(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
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user