mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
feat: use Cache instead of local storage for song sharing
This commit is contained in:
parent
023b504ef6
commit
44fa2d0179
2 changed files with 8 additions and 8 deletions
|
@ -51,10 +51,10 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { faCoffee } from '@fortawesome/free-solid-svg-icons'
|
||||
import { computed, ref, toRef, watch } from 'vue'
|
||||
import { computed, ref, toRef } from 'vue'
|
||||
import { logger, pluralize } from '@/utils'
|
||||
import { commonStore, queueStore, songStore } from '@/stores'
|
||||
import { localStorageService as storage, playbackService } from '@/services'
|
||||
import { cache, playbackService } from '@/services'
|
||||
import { useDialogBox, useRouter, useSongList, useSongListControls } from '@/composables'
|
||||
|
||||
import ScreenHeader from '@/components/ui/ScreenHeader.vue'
|
||||
|
@ -124,7 +124,7 @@ const onPressEnter = () => selectedSongs.value.length && playbackService.play(se
|
|||
const onReorder = (target: Song) => queueStore.move(selectedSongs.value, target)
|
||||
|
||||
onScreenActivated('Queue', async () => {
|
||||
if (!storage.get('song-to-queue')) {
|
||||
if (!cache.get('song-to-queue')) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ onScreenActivated('Queue', async () => {
|
|||
|
||||
try {
|
||||
loading.value = true
|
||||
song = await songStore.resolve(storage.get('song-to-queue')!)
|
||||
song = await songStore.resolve(cache.get('song-to-queue')!)
|
||||
|
||||
if (!song) {
|
||||
throw new Error('Song not found')
|
||||
|
@ -142,7 +142,7 @@ onScreenActivated('Queue', async () => {
|
|||
logger.error(e)
|
||||
return
|
||||
} finally {
|
||||
storage.remove('song-to-queue')
|
||||
cache.remove('song-to-queue')
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Route } from '@/router'
|
||||
import { userStore } from '@/stores'
|
||||
import { localStorageService, playlistCollaborationService } from '@/services'
|
||||
import { cache, playlistCollaborationService } from '@/services'
|
||||
import { useUpload } from '@/composables'
|
||||
import { forceReloadWindow, logger } from '@/utils'
|
||||
import { logger } from '@/utils'
|
||||
import Router from '@/router'
|
||||
|
||||
const UUID_REGEX = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
|
||||
|
@ -118,7 +118,7 @@ export const routes: Route[] = [
|
|||
screen: 'Queue',
|
||||
redirect: () => 'queue',
|
||||
onResolve: params => {
|
||||
localStorageService.set('song-to-queue', params.id)
|
||||
cache.set('song-to-queue', params.id)
|
||||
return true
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue