mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 02:46:16 -08:00
refactor: reset active channel when navigating back to the home view
This commit is contained in:
1 parent
fa8ea4015c
commit
a6d77db26b
3 files changed
+12
No files matched your search
@@ -3,6 +3,7 @@ import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Channel } from '../../../../../../shared/channel.interface';
|
||||
import { DataService } from '../../../../services/data.service';
|
||||
import * as PlaylistActions from '../../../../state/actions';
|
||||
import { selectPlaylistTitle } from '../../../../state/selectors';
|
||||
import { SidebarView } from '../video-player.component';
|
||||
|
||||
@@ -28,6 +29,7 @@ export class SidebarComponent {
|
||||
|
||||
goBack(): void {
|
||||
if (this.sidebarView === 'PLAYLISTS') {
|
||||
this.store.dispatch(PlaylistActions.resetActiveChannel());
|
||||
this.router.navigate(['/']);
|
||||
} else {
|
||||
this.sidebarView = 'PLAYLISTS';
|
||||
|
||||
@@ -71,6 +71,10 @@ export const setActiveChannel = createAction(
|
||||
props<{ channel: Channel }>()
|
||||
);
|
||||
|
||||
export const resetActiveChannel = createAction(
|
||||
`${STORE_KEY} Reset active channel`
|
||||
);
|
||||
|
||||
export const setActiveChannelSuccess = createAction(
|
||||
`${STORE_KEY} Set active channel success`,
|
||||
props<{ channel: Channel }>()
|
||||
|
||||
@@ -33,6 +33,12 @@ export const playlistReducer = createReducer(
|
||||
};
|
||||
}
|
||||
),
|
||||
on(PlaylistActions.resetActiveChannel, (state): PlaylistState => {
|
||||
return {
|
||||
...state,
|
||||
active: undefined,
|
||||
};
|
||||
}),
|
||||
on(
|
||||
PlaylistActions.setCurrentEpgProgram,
|
||||
(state, action): PlaylistState => ({
|
||||
|
||||
Reference in new issue
Block a user