From ec10e8ed5b903b0a4d7af5c4a1f03c5f2e89c6b1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Feb 2020 11:47:47 +0100 Subject: Fix playlist cache error --- client/src/app/shared/video-playlist/video-playlist.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'client') diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index bae6f9e04..38d915c6b 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts @@ -141,6 +141,8 @@ export class VideoPlaylistService { return this.authHttp.post<{ videoPlaylist: { id: number } }>(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL, data) .pipe( tap(res => { + if (!this.myAccountPlaylistCache) return + this.myAccountPlaylistCache.total++ this.myAccountPlaylistCache.data.push({ @@ -161,6 +163,8 @@ export class VideoPlaylistService { .pipe( map(this.restExtractor.extractDataBool), tap(() => { + if (!this.myAccountPlaylistCache) return + const playlist = this.myAccountPlaylistCache.data.find(p => p.id === videoPlaylist.id) playlist.displayName = body.displayName @@ -175,6 +179,8 @@ export class VideoPlaylistService { .pipe( map(this.restExtractor.extractDataBool), tap(() => { + if (!this.myAccountPlaylistCache) return + this.myAccountPlaylistCache.total-- this.myAccountPlaylistCache.data = this.myAccountPlaylistCache.data .filter(p => p.id !== videoPlaylist.id) -- cgit v1.2.3