diff --git a/cypress/config/settings.cypress.json b/cypress/config/settings.cypress.json
index c466b2bf..30190736 100644
--- a/cypress/config/settings.cypress.json
+++ b/cypress/config/settings.cypress.json
@@ -23,7 +23,6 @@
"mediaServerType": 1,
"partialRequestsEnabled": true,
"enableSpecialEpisodes": false,
- "forceIpv4First": false,
"locale": "en"
},
"plex": {
@@ -179,4 +178,4 @@
"schedule": "0 0 5 * * *"
}
}
-}
+}
\ No newline at end of file
diff --git a/jellyseerr-api.yml b/jellyseerr-api.yml
index 6954992d..b427bcf8 100644
--- a/jellyseerr-api.yml
+++ b/jellyseerr-api.yml
@@ -191,9 +191,6 @@ components:
csrfProtection:
type: boolean
example: false
- forceIpv4First:
- type: boolean
- example: false
trustProxy:
type: boolean
example: true
diff --git a/server/api/jellyfin.ts b/server/api/jellyfin.ts
index 6b965b8c..b09c8186 100644
--- a/server/api/jellyfin.ts
+++ b/server/api/jellyfin.ts
@@ -163,36 +163,36 @@ class JellyfinAPI extends ExternalAPI {
} catch (e) {
logger.debug('Failed to authenticate with headers', {
label: 'Jellyfin API',
- error: e.cause.message ?? e.cause.statusText,
+ error: e.response?.status,
ip: ClientIP,
});
- if (!e.cause.status) {
+ if (!e.response?.status) {
throw new ApiError(404, ApiErrorCode.InvalidUrl);
}
- if (e.cause.status === 401) {
- throw new ApiError(e.cause.status, ApiErrorCode.InvalidCredentials);
+ if (e.response?.status === 401) {
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidCredentials);
}
}
try {
return await authenticate(false);
} catch (e) {
- if (e.cause.status === 401) {
- throw new ApiError(e.cause.status, ApiErrorCode.InvalidCredentials);
+ if (e.response?.status === 401) {
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidCredentials);
}
logger.error(
- 'Something went wrong while authenticating with the Jellyfin server',
+ `Something went wrong while authenticating with the Jellyfin server: ${e.message}`,
{
label: 'Jellyfin API',
- error: e.cause.message ?? e.cause.statusText,
+ error: e.response?.status,
ip: ClientIP,
}
);
- throw new ApiError(e.cause.status, ApiErrorCode.Unknown);
+ throw new ApiError(e.response?.status, ApiErrorCode.Unknown);
}
}
@@ -207,7 +207,7 @@ class JellyfinAPI extends ExternalAPI {
return systemInfoResponse;
} catch (e) {
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -220,11 +220,11 @@ class JellyfinAPI extends ExternalAPI {
return serverResponse.ServerName;
} catch (e) {
logger.error(
- 'Something went wrong while getting the server name from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting the server name from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.Unknown);
+ throw new ApiError(e.response?.status, ApiErrorCode.Unknown);
}
}
@@ -235,11 +235,11 @@ class JellyfinAPI extends ExternalAPI {
return { users: userReponse };
} catch (e) {
logger.error(
- 'Something went wrong while getting the account from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting the account from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -251,11 +251,11 @@ class JellyfinAPI extends ExternalAPI {
return userReponse;
} catch (e) {
logger.error(
- 'Something went wrong while getting the account from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting the account from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -275,10 +275,10 @@ class JellyfinAPI extends ExternalAPI {
return this.mapLibraries(mediaFolderResponse.Items);
} catch (e) {
logger.error(
- 'Something went wrong while getting libraries from the Jellyfin server',
+ `Something went wrong while getting libraries from the Jellyfin server: ${e.message}`,
{
label: 'Jellyfin API',
- error: e.cause.message ?? e.cause.statusText,
+ error: e.response?.status,
}
);
@@ -324,11 +324,11 @@ class JellyfinAPI extends ExternalAPI {
);
} catch (e) {
logger.error(
- 'Something went wrong while getting library content from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting library content from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e?.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -349,11 +349,11 @@ class JellyfinAPI extends ExternalAPI {
return itemResponse;
} catch (e) {
logger.error(
- 'Something went wrong while getting library content from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting library content from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -371,16 +371,16 @@ class JellyfinAPI extends ExternalAPI {
return itemResponse.Items?.[0];
} catch (e) {
if (availabilitySync.running) {
- if (e.cause?.status === 500) {
+ if (e.response?.status === 500) {
return undefined;
}
}
logger.error(
- 'Something went wrong while getting library content from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting library content from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -391,11 +391,11 @@ class JellyfinAPI extends ExternalAPI {
return seasonResponse.Items;
} catch (e) {
logger.error(
- 'Something went wrong while getting the list of seasons from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting the list of seasons from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -413,11 +413,11 @@ class JellyfinAPI extends ExternalAPI {
);
} catch (e) {
logger.error(
- 'Something went wrong while getting the list of episodes from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while getting the list of episodes from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
- throw new ApiError(e.cause?.status, ApiErrorCode.InvalidAuthToken);
+ throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
}
}
@@ -430,8 +430,8 @@ class JellyfinAPI extends ExternalAPI {
).AccessToken;
} catch (e) {
logger.error(
- 'Something went wrong while creating an API key from the Jellyfin server',
- { label: 'Jellyfin API', error: e.cause.message ?? e.cause.statusText }
+ `Something went wrong while creating an API key from the Jellyfin server: ${e.message}`,
+ { label: 'Jellyfin API', error: e.response?.status }
);
throw new ApiError(e.response?.status, ApiErrorCode.InvalidAuthToken);
diff --git a/server/api/servarr/radarr.ts b/server/api/servarr/radarr.ts
index ceb3f10d..e11aca9a 100644
--- a/server/api/servarr/radarr.ts
+++ b/server/api/servarr/radarr.ts
@@ -214,20 +214,13 @@ class RadarrAPI extends ServarrBase<{ movieId: number }> {
}
return response.data;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error(
'Failed to add movie to Radarr. This might happen if the movie already exists, in which case you can safely ignore this error.',
{
label: 'Radarr',
errorMessage: e.message,
options,
- response: errorData,
+ response: e?.response?.data,
}
);
throw new Error('Failed to add movie to Radarr');
diff --git a/server/api/servarr/sonarr.ts b/server/api/servarr/sonarr.ts
index f9199f4c..ab8e837e 100644
--- a/server/api/servarr/sonarr.ts
+++ b/server/api/servarr/sonarr.ts
@@ -266,18 +266,11 @@ class SonarrAPI extends ServarrBase<{
return createdSeriesResponse.data;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Something went wrong while adding a series to Sonarr.', {
label: 'Sonarr API',
errorMessage: e.message,
options,
- response: errorData,
+ response: e?.response?.data,
});
throw new Error('Failed to add series');
}
diff --git a/server/index.ts b/server/index.ts
index 31fdfc99..506dfcec 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -24,7 +24,6 @@ import avatarproxy from '@server/routes/avatarproxy';
import imageproxy from '@server/routes/imageproxy';
import { appDataPermissions } from '@server/utils/appDataVolume';
import { getAppVersion } from '@server/utils/appVersion';
-// import createCustomProxyAgent from '@server/utils/customProxyAgent';
import restartFlag from '@server/utils/restartFlag';
import { getClientIp } from '@supercharge/request-ip';
import { TypeormStore } from 'connect-typeorm/out';
@@ -72,20 +71,6 @@ app
const settings = await getSettings().load();
restartFlag.initializeSettings(settings);
- // // Check if we force IPv4 first
- // if (
- // process.env.forceIpv4First === 'true' ||
- // settings.network.forceIpv4First
- // ) {
- // dns.setDefaultResultOrder('ipv4first');
- // net.setDefaultAutoSelectFamily(false);
- // }
-
- // // Register HTTP proxy
- // if (settings.network.proxy.enabled) {
- // await createCustomProxyAgent(settings.network.proxy);
- // }
-
// Migrate library types
if (
settings.plex.libraries.length > 1 &&
diff --git a/server/lib/notifications/agents/discord.ts b/server/lib/notifications/agents/discord.ts
index 6cd22395..cabd332d 100644
--- a/server/lib/notifications/agents/discord.ts
+++ b/server/lib/notifications/agents/discord.ts
@@ -309,19 +309,12 @@ class DiscordAgent
return true;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending Discord notification', {
label: 'Notifications',
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
diff --git a/server/lib/notifications/agents/gotify.ts b/server/lib/notifications/agents/gotify.ts
index c36fc453..514281f7 100644
--- a/server/lib/notifications/agents/gotify.ts
+++ b/server/lib/notifications/agents/gotify.ts
@@ -144,19 +144,12 @@ class GotifyAgent
return true;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending Gotify notification', {
label: 'Notifications',
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
diff --git a/server/lib/notifications/agents/lunasea.ts b/server/lib/notifications/agents/lunasea.ts
index 05bd48de..acfa7df9 100644
--- a/server/lib/notifications/agents/lunasea.ts
+++ b/server/lib/notifications/agents/lunasea.ts
@@ -117,19 +117,12 @@ class LunaSeaAgent
return true;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending LunaSea notification', {
label: 'Notifications',
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
diff --git a/server/lib/notifications/agents/pushover.ts b/server/lib/notifications/agents/pushover.ts
index dfce656f..7abf0d72 100644
--- a/server/lib/notifications/agents/pushover.ts
+++ b/server/lib/notifications/agents/pushover.ts
@@ -65,17 +65,10 @@ class PushoverAgent
attachment_type: contentType,
};
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error getting image payload', {
label: 'Notifications',
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return {};
}
diff --git a/server/lib/notifications/agents/slack.ts b/server/lib/notifications/agents/slack.ts
index d24e554c..8f1f0c95 100644
--- a/server/lib/notifications/agents/slack.ts
+++ b/server/lib/notifications/agents/slack.ts
@@ -245,19 +245,12 @@ class SlackAgent
return true;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending Slack notification', {
label: 'Notifications',
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
diff --git a/server/lib/notifications/agents/telegram.ts b/server/lib/notifications/agents/telegram.ts
index 580ed576..10d4bce4 100644
--- a/server/lib/notifications/agents/telegram.ts
+++ b/server/lib/notifications/agents/telegram.ts
@@ -183,19 +183,12 @@ class TelegramAgent
disable_notification: !!settings.options.sendSilently,
} as TelegramMessagePayload | TelegramPhotoPayload);
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending Telegram notification', {
label: 'Notifications',
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
@@ -226,20 +219,13 @@ class TelegramAgent
!!payload.notifyUser.settings.telegramSendSilently,
} as TelegramMessagePayload | TelegramPhotoPayload);
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending Telegram notification', {
label: 'Notifications',
recipient: payload.notifyUser.displayName,
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
@@ -279,20 +265,13 @@ class TelegramAgent
disable_notification: !!user.settings?.telegramSendSilently,
} as TelegramMessagePayload | TelegramPhotoPayload);
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending Telegram notification', {
label: 'Notifications',
recipient: user.displayName,
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
diff --git a/server/lib/notifications/agents/webhook.ts b/server/lib/notifications/agents/webhook.ts
index 7d948db7..c441cb65 100644
--- a/server/lib/notifications/agents/webhook.ts
+++ b/server/lib/notifications/agents/webhook.ts
@@ -192,19 +192,12 @@ class WebhookAgent
return true;
} catch (e) {
- let errorData;
- try {
- errorData = await e.cause?.text();
- errorData = JSON.parse(errorData);
- } catch {
- /* empty */
- }
logger.error('Error sending webhook notification', {
label: 'Notifications',
type: Notification[type],
subject: payload.subject,
errorMessage: e.message,
- response: errorData,
+ response: e?.response?.data,
});
return false;
diff --git a/server/lib/settings/index.ts b/server/lib/settings/index.ts
index 3630c42e..a4738d65 100644
--- a/server/lib/settings/index.ts
+++ b/server/lib/settings/index.ts
@@ -136,7 +136,6 @@ export interface MainSettings {
export interface NetworkSettings {
csrfProtection: boolean;
- forceIpv4First: boolean;
trustProxy: boolean;
proxy: ProxySettings;
}
@@ -510,7 +509,6 @@ class Settings {
network: {
csrfProtection: false,
trustProxy: false,
- forceIpv4First: false,
proxy: {
enabled: false,
hostname: '',
diff --git a/server/utils/customProxyAgent.ts b/server/utils/customProxyAgent.ts
deleted file mode 100644
index 5f163c3d..00000000
--- a/server/utils/customProxyAgent.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-import type { ProxySettings } from '@server/lib/settings';
-import logger from '@server/logger';
-import type { Dispatcher } from 'undici';
-import { Agent, ProxyAgent, setGlobalDispatcher } from 'undici';
-
-export default async function createCustomProxyAgent(
- proxySettings: ProxySettings
-) {
- const defaultAgent = new Agent({ keepAliveTimeout: 5000 });
-
- const skipUrl = (url: string | URL) => {
- const hostname =
- typeof url === 'string' ? new URL(url).hostname : url.hostname;
-
- if (proxySettings.bypassLocalAddresses && isLocalAddress(hostname)) {
- return true;
- }
-
- for (const address of proxySettings.bypassFilter.split(',')) {
- const trimmedAddress = address.trim();
- if (!trimmedAddress) {
- continue;
- }
-
- if (trimmedAddress.startsWith('*')) {
- const domain = trimmedAddress.slice(1);
- if (hostname.endsWith(domain)) {
- return true;
- }
- } else if (hostname === trimmedAddress) {
- return true;
- }
- }
-
- return false;
- };
-
- const noProxyInterceptor = (
- dispatch: Dispatcher['dispatch']
- ): Dispatcher['dispatch'] => {
- return (opts, handler) => {
- return opts.origin && skipUrl(opts.origin)
- ? defaultAgent.dispatch(opts, handler)
- : dispatch(opts, handler);
- };
- };
-
- const token =
- proxySettings.user && proxySettings.password
- ? `Basic ${Buffer.from(
- `${proxySettings.user}:${proxySettings.password}`
- ).toString('base64')}`
- : undefined;
-
- try {
- const proxyAgent = new ProxyAgent({
- uri:
- (proxySettings.useSsl ? 'https://' : 'http://') +
- proxySettings.hostname +
- ':' +
- proxySettings.port,
- token,
- keepAliveTimeout: 5000,
- });
-
- setGlobalDispatcher(proxyAgent.compose(noProxyInterceptor));
- } catch (e) {
- logger.error('Failed to connect to the proxy: ' + e.message, {
- label: 'Proxy',
- });
- setGlobalDispatcher(defaultAgent);
- return;
- }
-
- try {
- const res = await fetch('https://www.google.com', { method: 'HEAD' });
- if (res.ok) {
- logger.debug('HTTP(S) proxy connected successfully', { label: 'Proxy' });
- } else {
- logger.error('Proxy responded, but with a non-OK status: ' + res.status, {
- label: 'Proxy',
- });
- setGlobalDispatcher(defaultAgent);
- }
- } catch (e) {
- logger.error(
- 'Failed to connect to the proxy: ' + e.message + ': ' + e.cause,
- { label: 'Proxy' }
- );
- setGlobalDispatcher(defaultAgent);
- }
-}
-
-function isLocalAddress(hostname: string) {
- if (
- hostname === 'localhost' ||
- hostname === '127.0.0.1' ||
- hostname === '::1'
- ) {
- return true;
- }
-
- const privateIpRanges = [
- /^10\./, // 10.x.x.x
- /^172\.(1[6-9]|2[0-9]|3[0-1])\./, // 172.16.x.x - 172.31.x.x
- /^192\.168\./, // 192.168.x.x
- ];
- if (privateIpRanges.some((regex) => regex.test(hostname))) {
- return true;
- }
-
- return false;
-}
diff --git a/server/utils/restartFlag.ts b/server/utils/restartFlag.ts
index ffd64df3..d0a492ba 100644
--- a/server/utils/restartFlag.ts
+++ b/server/utils/restartFlag.ts
@@ -17,8 +17,7 @@ class RestartFlag {
return (
this.networkSettings.csrfProtection !== networkSettings.csrfProtection ||
this.networkSettings.trustProxy !== networkSettings.trustProxy ||
- this.networkSettings.proxy.enabled !== networkSettings.proxy.enabled ||
- this.networkSettings.forceIpv4First !== networkSettings.forceIpv4First
+ this.networkSettings.proxy.enabled !== networkSettings.proxy.enabled
);
}
}
diff --git a/src/components/Blacklist/index.tsx b/src/components/Blacklist/index.tsx
index 4d4eb0b4..5c83465f 100644
--- a/src/components/Blacklist/index.tsx
+++ b/src/components/Blacklist/index.tsx
@@ -239,9 +239,9 @@ const BlacklistedItem = ({ item, revalidateList }: BlacklistedItemProps) => {
const removeFromBlacklist = async (tmdbId: number, title?: string) => {
setIsUpdating(true);
- const res = await axios.delete(`/api/v1/blacklist/${tmdbId}`);
+ try {
+ await axios.delete(`/api/v1/blacklist/${tmdbId}`);
- if (res.status === 204) {
addToast(
{intl.formatMessage(globalMessages.removeFromBlacklistSuccess, {
@@ -251,7 +251,7 @@ const BlacklistedItem = ({ item, revalidateList }: BlacklistedItemProps) => {
,
{ appearance: 'success', autoDismiss: true }
);
- } else {
+ } catch {
addToast(intl.formatMessage(globalMessages.blacklistError), {
appearance: 'error',
autoDismiss: true,
diff --git a/src/components/BlacklistBlock/index.tsx b/src/components/BlacklistBlock/index.tsx
index d7aa3347..6980a02e 100644
--- a/src/components/BlacklistBlock/index.tsx
+++ b/src/components/BlacklistBlock/index.tsx
@@ -39,9 +39,9 @@ const BlacklistBlock = ({
const removeFromBlacklist = async (tmdbId: number, title?: string) => {
setIsUpdating(true);
- const res = await axios.delete('/api/v1/blacklist/' + tmdbId);
+ try {
+ await axios.delete('/api/v1/blacklist/' + tmdbId);
- if (res.status === 204) {
addToast(
{intl.formatMessage(globalMessages.removeFromBlacklistSuccess, {
@@ -51,7 +51,7 @@ const BlacklistBlock = ({
,
{ appearance: 'success', autoDismiss: true }
);
- } else {
+ } catch {
addToast(intl.formatMessage(globalMessages.blacklistError), {
appearance: 'error',
autoDismiss: true,
diff --git a/src/components/MovieDetails/index.tsx b/src/components/MovieDetails/index.tsx
index 97bb4174..29b3ab56 100644
--- a/src/components/MovieDetails/index.tsx
+++ b/src/components/MovieDetails/index.tsx
@@ -327,9 +327,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
title: movie?.title,
});
- const data = await response.json();
-
- if (data) {
+ if (response.data) {
addToast(
{intl.formatMessage(messages.watchlistSuccess, {
@@ -354,19 +352,17 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
const onClickDeleteWatchlistBtn = async (): Promise