fix: playNext and playPrevious logic

This commit is contained in:
Prayag Prajapati committed 2024-07-19 19:42:55 +05:30
1 parent d077860fbc
commit 70c6dd927b
5 files changed
+93 -69

No files matched your search

+3 -2
View File
@@ -4,7 +4,7 @@ import useQueue from "@/utils/store/queue";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { IconButton } from "@mui/material";
import { useMutation, useQuery } from "@tanstack/react-query";
import { useRouteContext } from "@tanstack/react-router";
import { useNavigate, useRouteContext } from "@tanstack/react-router";
import React from "react";
const PlayNextButton = () => {
@@ -16,9 +16,10 @@ const PlayNextButton = () => {
return result.data;
},
});
const navigate = useNavigate();
const handlePlayNext = useMutation({
mutationKey: ["playNextButton"],
mutationFn: () => playItemFromQueue("next", user.data?.Id),
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
onError: (error) => [console.error(error)],
});
const [queueItems, currentItemIndex] = useQueue((state) => [