Delegate queue migration
This commit is contained in:
parent
e4759d14c9
commit
ece2c468ca
|
@ -308,25 +308,25 @@ export const useQueue = createGlobalState(() => {
|
|||
return store.dispatch('radios/stop')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Remove at 1.5.0
|
||||
// Migrate old queue format to the new one
|
||||
if (localStorage.queue) {
|
||||
(async () => {
|
||||
const { queue: { currentIndex: index, tracks } } = JSON.parse(localStorage.queue) as { queue: { currentIndex: number, tracks: Track[] } }
|
||||
if (tracks.length !== 0) {
|
||||
await enqueue(...tracks)
|
||||
}
|
||||
// TODO: Remove at 1.5.0
|
||||
// Migrate old queue format to the new one
|
||||
if (localStorage.queue) {
|
||||
(async () => {
|
||||
const { queue: { currentIndex: index, tracks } } = JSON.parse(localStorage.queue) as { queue: { currentIndex: number, tracks: Track[] } }
|
||||
if (tracks.length !== 0) {
|
||||
await enqueue(...tracks)
|
||||
}
|
||||
|
||||
currentIndex.value = index
|
||||
delete localStorage.queue
|
||||
currentIndex.value = index
|
||||
delete localStorage.queue
|
||||
|
||||
const { looping: loopingMode, volume } = JSON.parse(localStorage.player)
|
||||
looping.value = loopingMode
|
||||
setGain(volume)
|
||||
delete localStorage.player
|
||||
})().catch((error) => console.error('Could not successfully migrate between queue versions', error))
|
||||
const { looping: loopingMode, volume } = JSON.parse(localStorage.player)
|
||||
looping.value = loopingMode
|
||||
setGain(volume)
|
||||
delete localStorage.player
|
||||
})().catch((error) => console.error('Could not successfully migrate between queue versions', error))
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue