From ff10d9453607468c0a290100f8062181361ae28a Mon Sep 17 00:00:00 2001 From: Discreater Date: Sun, 6 Oct 2024 14:07:49 +0800 Subject: [PATCH] fix: no playqueue --- src/store/index.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index cb8fe1a..ee46a4d 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,16 +1,16 @@ import { createPinia, defineStore } from 'pinia'; import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'; -import { usePlayerStore } from './player'; -import { useAccountStore } from './user'; import { ApiClient, WsClient } from '~/api/client'; import type { Track } from '~/generated/protos/musync'; +import { useLoading } from '~/logic'; import type { TrackId } from '~/model_ext/track'; import type { LocalFolder } from '~/sources/folder'; - import type { JellyfinClientOptions } from '~/sources/jellyfin'; + import { mod, shuffle } from '~/utils'; -import { useLoading } from '~/logic'; import { logger } from '~/utils/logger'; +import { usePlayerStore } from './player'; +import { useAccountStore } from './user'; export function sameTrack(a: Track | undefined, b: Track | undefined): boolean { if (!a || !b) @@ -127,8 +127,13 @@ export const useMusyncStore = defineStore('musync', { async updatePlayQueueFromRemote(trackIds?: TrackId[]) { logger.trace('update play queue from remote'); if (!trackIds) { - const play_queue = await ApiClient.grpc().GetPlayQueue({}); - trackIds = play_queue.trackIds; + try { + const play_queue = await ApiClient.grpc().GetPlayQueue({}); + trackIds = play_queue.trackIds; + } catch (e) { + console.error(e); + return; + } } const tracks = trackIds .map(id =>