mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-10 00:28:09 -05:00
fix: rewrite request from axios to Fetch (#920)
This commit is contained in:
@@ -26,7 +26,7 @@ import useLocale from '@app/hooks/useLocale';
|
|||||||
import useSettings from '@app/hooks/useSettings';
|
import useSettings from '@app/hooks/useSettings';
|
||||||
import { Permission, useUser } from '@app/hooks/useUser';
|
import { Permission, useUser } from '@app/hooks/useUser';
|
||||||
import globalMessages from '@app/i18n/globalMessages';
|
import globalMessages from '@app/i18n/globalMessages';
|
||||||
import Error from '@app/pages/_error';
|
import ErrorPage from '@app/pages/_error';
|
||||||
import { sortCrewPriority } from '@app/utils/creditHelpers';
|
import { sortCrewPriority } from '@app/utils/creditHelpers';
|
||||||
import defineMessages from '@app/utils/defineMessages';
|
import defineMessages from '@app/utils/defineMessages';
|
||||||
import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper';
|
import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper';
|
||||||
@@ -49,9 +49,7 @@ import { type RatingResponse } from '@server/api/ratings';
|
|||||||
import { IssueStatus } from '@server/constants/issue';
|
import { IssueStatus } from '@server/constants/issue';
|
||||||
import { MediaStatus, MediaType } from '@server/constants/media';
|
import { MediaStatus, MediaType } from '@server/constants/media';
|
||||||
import { MediaServerType } from '@server/constants/server';
|
import { MediaServerType } from '@server/constants/server';
|
||||||
import type { Watchlist } from '@server/entity/Watchlist';
|
|
||||||
import type { MovieDetails as MovieDetailsType } from '@server/models/Movie';
|
import type { MovieDetails as MovieDetailsType } from '@server/models/Movie';
|
||||||
import axios from 'axios';
|
|
||||||
import { countries } from 'country-flag-icons';
|
import { countries } from 'country-flag-icons';
|
||||||
import 'country-flag-icons/3x2/flags.css';
|
import 'country-flag-icons/3x2/flags.css';
|
||||||
import { uniqBy } from 'lodash';
|
import { uniqBy } from 'lodash';
|
||||||
@@ -171,7 +169,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <Error statusCode={404} />;
|
return <ErrorPage statusCode={404} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const showAllStudios = data.productionCompanies.length <= minStudios + 1;
|
const showAllStudios = data.productionCompanies.length <= minStudios + 1;
|
||||||
@@ -351,11 +349,12 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
|
|||||||
const onClickDeleteWatchlistBtn = async (): Promise<void> => {
|
const onClickDeleteWatchlistBtn = async (): Promise<void> => {
|
||||||
setIsUpdating(true);
|
setIsUpdating(true);
|
||||||
try {
|
try {
|
||||||
const response = await axios.delete<Watchlist>(
|
const res = await fetch(`/api/v1/watchlist/${movie?.id}`, {
|
||||||
'/api/v1/watchlist/' + movie?.id
|
method: 'DELETE',
|
||||||
);
|
});
|
||||||
|
if (!res.ok) throw new Error();
|
||||||
|
|
||||||
if (response.status === 204) {
|
if (res.status === 204) {
|
||||||
addToast(
|
addToast(
|
||||||
<span>
|
<span>
|
||||||
{intl.formatMessage(messages.watchlistDeleted, {
|
{intl.formatMessage(messages.watchlistDeleted, {
|
||||||
|
|||||||
Reference in New Issue
Block a user