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')
|
return store.dispatch('radios/stop')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Remove at 1.5.0
|
// TODO: Remove at 1.5.0
|
||||||
// Migrate old queue format to the new one
|
// Migrate old queue format to the new one
|
||||||
if (localStorage.queue) {
|
if (localStorage.queue) {
|
||||||
(async () => {
|
(async () => {
|
||||||
const { queue: { currentIndex: index, tracks } } = JSON.parse(localStorage.queue) as { queue: { currentIndex: number, tracks: Track[] } }
|
const { queue: { currentIndex: index, tracks } } = JSON.parse(localStorage.queue) as { queue: { currentIndex: number, tracks: Track[] } }
|
||||||
if (tracks.length !== 0) {
|
if (tracks.length !== 0) {
|
||||||
await enqueue(...tracks)
|
await enqueue(...tracks)
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIndex.value = index
|
currentIndex.value = index
|
||||||
delete localStorage.queue
|
delete localStorage.queue
|
||||||
|
|
||||||
const { looping: loopingMode, volume } = JSON.parse(localStorage.player)
|
const { looping: loopingMode, volume } = JSON.parse(localStorage.player)
|
||||||
looping.value = loopingMode
|
looping.value = loopingMode
|
||||||
setGain(volume)
|
setGain(volume)
|
||||||
delete localStorage.player
|
delete localStorage.player
|
||||||
})().catch((error) => console.error('Could not successfully migrate between queue versions', error))
|
})().catch((error) => console.error('Could not successfully migrate between queue versions', error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue