also includes new api endpoints for seasonspull/107/head
parent
1be8b18361
commit
2bf7e10e32
@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
import useSWR from 'swr';
|
||||
import MovieRequestModal from './MovieRequestModal';
|
||||
import type { MediaRequest } from '../../../server/entity/MediaRequest';
|
||||
import type { MediaStatus } from '../../../server/constants/media';
|
||||
|
||||
interface RequestModalProps {
|
||||
requestId?: number;
|
||||
show: boolean;
|
||||
type: 'movie' | 'tv';
|
||||
tmdbId: number;
|
||||
onComplete?: (newStatus: MediaStatus) => void;
|
||||
onError?: (error: string) => void;
|
||||
onCancel?: () => void;
|
||||
onUpdating?: (isUpdating: boolean) => void;
|
||||
}
|
||||
|
||||
const RequestModal: React.FC<RequestModalProps> = ({
|
||||
type,
|
||||
requestId,
|
||||
show,
|
||||
tmdbId,
|
||||
onComplete,
|
||||
onError,
|
||||
onUpdating,
|
||||
onCancel,
|
||||
}) => {
|
||||
const { data } = useSWR<MediaRequest>(
|
||||
requestId ? `/api/v1/request/${requestId}` : null
|
||||
);
|
||||
if (type === 'tv') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<MovieRequestModal
|
||||
onComplete={onComplete}
|
||||
onCancel={onCancel}
|
||||
visible={show}
|
||||
request={data}
|
||||
tmdbId={tmdbId}
|
||||
onUpdating={onUpdating}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RequestModal;
|
Loading…
Reference in new issue