diff --git a/src/components/RequestModal/MovieRequestModal.tsx b/src/components/RequestModal/MovieRequestModal.tsx index c74954156..b42cce719 100644 --- a/src/components/RequestModal/MovieRequestModal.tsx +++ b/src/components/RequestModal/MovieRequestModal.tsx @@ -3,7 +3,7 @@ import axios from 'axios'; import React, { useCallback, useEffect, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useToasts } from 'react-toast-notifications'; -import useSWR from 'swr'; +import useSWR, { mutate } from 'swr'; import { MediaStatus } from '../../../server/constants/media'; import type { MediaRequest } from '../../../server/entity/MediaRequest'; import type { QuotaResponse } from '../../../server/interfaces/api/userInterfaces'; @@ -95,6 +95,7 @@ const MovieRequestModal = ({ is4k, ...overrideParams, }); + mutate('/api/v1/request?filter=all&take=10&sort=modified&skip=0'); if (response.data) { if (onComplete) { @@ -138,6 +139,7 @@ const MovieRequestModal = ({ const response = await axios.delete( `/api/v1/request/${editRequest?.id}` ); + mutate('/api/v1/request?filter=all&take=10&sort=modified&skip=0'); if (response.status === 204) { if (onComplete) { @@ -174,6 +176,7 @@ const MovieRequestModal = ({ if (alsoApproveRequest) { await axios.post(`/api/v1/request/${editRequest?.id}/approve`); } + mutate('/api/v1/request?filter=all&take=10&sort=modified&skip=0'); addToast( diff --git a/src/components/RequestModal/TvRequestModal.tsx b/src/components/RequestModal/TvRequestModal.tsx index a081bd04b..60613b3f0 100644 --- a/src/components/RequestModal/TvRequestModal.tsx +++ b/src/components/RequestModal/TvRequestModal.tsx @@ -3,7 +3,7 @@ import axios from 'axios'; import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useToasts } from 'react-toast-notifications'; -import useSWR from 'swr'; +import useSWR, { mutate } from 'swr'; import { ANIME_KEYWORD_ID } from '../../../server/api/themoviedb/constants'; import { MediaRequestStatus, @@ -131,6 +131,7 @@ const TvRequestModal = ({ } else { await axios.delete(`/api/v1/request/${editRequest.id}`); } + mutate('/api/v1/request?filter=all&take=10&sort=modified&skip=0'); addToast( @@ -205,6 +206,7 @@ const TvRequestModal = ({ ), ...overrideParams, }); + mutate('/api/v1/request?filter=all&take=10&sort=modified&skip=0'); if (response.data) { if (onComplete) {