fix: improper handling of undefined api leading to crashes

This commit is contained in:
Prayag Prajapati committed 2024-11-25 00:11:53 +05:30
1 parent c6b5d6a4a2
commit 81695a583d
9 files changed
+73 -67

No files matched your search

+5 -1
View File
@@ -125,8 +125,12 @@ export const playItem = (
export const playItemFromQueue = async (
index: "next" | "previous" | number,
userId: string | undefined,
api: Api,
api: Api | undefined,
) => {
if (!api) {
console.error("Unable to play item from from queue. No API provided");
return;
}
const queueItems = useQueue.getState().tracks;
const currentItemIndex = useQueue.getState().currentItemIndex;
const requestedItemIndex =