diff --git a/src/components/MovieDetails/index.tsx b/src/components/MovieDetails/index.tsx index 943e62c54..7bea8d5eb 100644 --- a/src/components/MovieDetails/index.tsx +++ b/src/components/MovieDetails/index.tsx @@ -99,7 +99,10 @@ const MovieDetails: React.FC = ({ movie }) => { show={showRequestModal} type="movie" requestId={data.mediaInfo?.requests?.[0]?.id} - onComplete={() => revalidate()} + onComplete={() => { + revalidate(); + setShowRequestModal(false); + }} onCancel={() => setShowRequestModal(false)} />
diff --git a/src/components/TitleCard/index.tsx b/src/components/TitleCard/index.tsx index 051075a92..d90de4960 100644 --- a/src/components/TitleCard/index.tsx +++ b/src/components/TitleCard/index.tsx @@ -1,5 +1,4 @@ import React, { useState } from 'react'; -import { useToasts } from 'react-toast-notifications'; import type { MediaType } from '../../../server/models/Search'; import Available from '../../assets/available.svg'; import Requested from '../../assets/requested.svg'; @@ -7,9 +6,6 @@ import Unavailable from '../../assets/unavailable.svg'; import { withProperties } from '../../utils/typeHelpers'; import Transition from '../Transition'; import Placeholder from './Placeholder'; -import axios from 'axios'; -import { MediaRequest } from '../../../server/entity/MediaRequest'; -import MovieRequestModal from '../RequestModal/MovieRequestModal'; import Link from 'next/link'; import { MediaStatus } from '../../../server/constants/media'; import RequestModal from '../RequestModal'; @@ -40,7 +36,6 @@ const TitleCard: React.FC = ({ const [currentStatus, setCurrentStatus] = useState(status); const [showDetail, setShowDetail] = useState(false); const [showRequestModal, setShowRequestModal] = useState(false); - const [showCancelModal, setShowCancelModal] = useState(false); // Just to get the year from the date if (year) { @@ -54,7 +49,10 @@ const TitleCard: React.FC = ({ show={showRequestModal} type={mediaType === 'movie' ? 'movie' : 'tv'} requestId={requestId} - onComplete={(newStatus) => setCurrentStatus(newStatus)} + onComplete={(newStatus) => { + setCurrentStatus(newStatus); + setShowRequestModal(false); + }} onUpdating={(status) => setIsUpdating(status)} onCancel={() => setShowRequestModal(false)} /> @@ -129,7 +127,7 @@ const TitleCard: React.FC = ({ = ({ )} {currentStatus === MediaStatus.PENDING && ( -