mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-03 13:18:53 -05:00
fix: fix remove from *arr in item details (#1387)
Fix the "Remove From *arr" button in the slideover of the movie/series details page. The issue was caused by an attempt to delete a file that didn't exist.
This commit is contained in:
@@ -122,15 +122,13 @@ const ManageSlideOver = ({
|
|||||||
|
|
||||||
const deleteMediaFile = async () => {
|
const deleteMediaFile = async () => {
|
||||||
if (data.mediaInfo) {
|
if (data.mediaInfo) {
|
||||||
const res1 = await fetch(`/api/v1/media/${data.mediaInfo.id}/file`, {
|
// we don't check if the response is ok here because there may be no file to delete
|
||||||
|
await fetch(`/api/v1/media/${data.mediaInfo.id}/file`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
if (!res1.ok) throw new Error();
|
await fetch(`/api/v1/media/${data.mediaInfo.id}`, {
|
||||||
|
|
||||||
const res2 = await fetch(`/api/v1/media/${data.mediaInfo.id}`, {
|
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
if (!res2.ok) throw new Error();
|
|
||||||
|
|
||||||
revalidate();
|
revalidate();
|
||||||
onClose();
|
onClose();
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
|
|||||||
|
|
||||||
const deleteMediaFile = async () => {
|
const deleteMediaFile = async () => {
|
||||||
if (request.media) {
|
if (request.media) {
|
||||||
|
// we don't check if the response is ok here because there may be no file to delete
|
||||||
await fetch(`/api/v1/media/${request.media.id}/file`, {
|
await fetch(`/api/v1/media/${request.media.id}/file`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user