mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
rebuild queue with new urls on net state change
This commit is contained in:
+1
-12
@@ -35,19 +35,8 @@ export type MusicMapSlice = {
|
||||
mapPlaylistWithSongs: (playlist: PlaylistWithSongsElement) => Promise<PlaylistWithSongs>
|
||||
}
|
||||
|
||||
class NoClientError extends Error {
|
||||
constructor() {
|
||||
super('no client in state')
|
||||
}
|
||||
}
|
||||
|
||||
export const createMusicMapSlice = (set: SetState<Store>, get: GetState<Store>): MusicMapSlice => ({
|
||||
mapChildToSong: async child => {
|
||||
const client = get().client
|
||||
if (!client) {
|
||||
throw new NoClientError()
|
||||
}
|
||||
|
||||
return {
|
||||
itemType: 'song',
|
||||
id: child.id,
|
||||
@@ -60,7 +49,7 @@ export const createMusicMapSlice = (set: SetState<Store>, get: GetState<Store>):
|
||||
duration: child.duration,
|
||||
starred: child.starred,
|
||||
coverArt: await get().getAlbumCoverArt(child.albumId),
|
||||
streamUri: client.streamUri({ id: child.id }),
|
||||
streamUri: get().buildStreamUri(child.id),
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user