diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-17 11:47:47 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-17 11:47:47 +0100 |
commit | ec10e8ed5b903b0a4d7af5c4a1f03c5f2e89c6b1 (patch) | |
tree | ed199ed48762b9cde35bf171d2e1cc8ad8326ac8 /client/src/app/shared | |
parent | 55bc5f481318ea9cb06d88c5fee5b2408c89c7f3 (diff) | |
download | PeerTube-ec10e8ed5b903b0a4d7af5c4a1f03c5f2e89c6b1.tar.gz PeerTube-ec10e8ed5b903b0a4d7af5c4a1f03c5f2e89c6b1.tar.zst PeerTube-ec10e8ed5b903b0a4d7af5c4a1f03c5f2e89c6b1.zip |
Fix playlist cache error
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.service.ts | 6 |
1 files changed, 6 insertions, 0 deletions
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 { | |||
141 | return this.authHttp.post<{ videoPlaylist: { id: number } }>(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL, data) | 141 | return this.authHttp.post<{ videoPlaylist: { id: number } }>(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL, data) |
142 | .pipe( | 142 | .pipe( |
143 | tap(res => { | 143 | tap(res => { |
144 | if (!this.myAccountPlaylistCache) return | ||
145 | |||
144 | this.myAccountPlaylistCache.total++ | 146 | this.myAccountPlaylistCache.total++ |
145 | 147 | ||
146 | this.myAccountPlaylistCache.data.push({ | 148 | this.myAccountPlaylistCache.data.push({ |
@@ -161,6 +163,8 @@ export class VideoPlaylistService { | |||
161 | .pipe( | 163 | .pipe( |
162 | map(this.restExtractor.extractDataBool), | 164 | map(this.restExtractor.extractDataBool), |
163 | tap(() => { | 165 | tap(() => { |
166 | if (!this.myAccountPlaylistCache) return | ||
167 | |||
164 | const playlist = this.myAccountPlaylistCache.data.find(p => p.id === videoPlaylist.id) | 168 | const playlist = this.myAccountPlaylistCache.data.find(p => p.id === videoPlaylist.id) |
165 | playlist.displayName = body.displayName | 169 | playlist.displayName = body.displayName |
166 | 170 | ||
@@ -175,6 +179,8 @@ export class VideoPlaylistService { | |||
175 | .pipe( | 179 | .pipe( |
176 | map(this.restExtractor.extractDataBool), | 180 | map(this.restExtractor.extractDataBool), |
177 | tap(() => { | 181 | tap(() => { |
182 | if (!this.myAccountPlaylistCache) return | ||
183 | |||
178 | this.myAccountPlaylistCache.total-- | 184 | this.myAccountPlaylistCache.total-- |
179 | this.myAccountPlaylistCache.data = this.myAccountPlaylistCache.data | 185 | this.myAccountPlaylistCache.data = this.myAccountPlaylistCache.data |
180 | .filter(p => p.id !== videoPlaylist.id) | 186 | .filter(p => p.id !== videoPlaylist.id) |