feat(api): generate models for patched products, refunds, site configurations, payments, and user registration
- Added PatchedProduct, PatchedProductImage, PatchedRefund, and related models. - Introduced Payment, PaymentBody, PaymentCreate, and PaymentRead models. - Created enums for payment methods, reasons for refunds, roles, and shipping methods. - Implemented models for site configurations and their opening hours. - Added ZasilkovnaPacket and ZasilkovnaShipment models for handling shipping data. - Generated user registration model with validation rules. - Updated public API functions to support new models and queries.
This commit is contained in:
@@ -1,8 +1,60 @@
|
||||
import { useState } from 'react';
|
||||
import { useApiDownloaderDownloadRetrieve } from '@/api/generated/public/downloader';
|
||||
|
||||
export default function Downloader() {
|
||||
const [videoUrl, setVideoUrl] = useState('');
|
||||
|
||||
// The hook needs: (params, options)
|
||||
// params = { url: string }
|
||||
// options = { query: { enabled: boolean } }
|
||||
const { data: videoInfo, isLoading, error } = useApiDownloaderDownloadRetrieve(
|
||||
{ url: videoUrl }, // 1st arg: parameters
|
||||
{
|
||||
query: {
|
||||
enabled: videoUrl.length > 10, // 2nd arg: query options (only fetch when URL is valid)
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
not implemented yet
|
||||
</>
|
||||
<div className="p-6">
|
||||
<h1 className="text-2xl font-bold mb-4">Video Downloader</h1>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
value={videoUrl}
|
||||
onChange={(e) => setVideoUrl(e.target.value)}
|
||||
placeholder="Paste video URL here"
|
||||
className="w-full p-2 border rounded mb-4"
|
||||
/>
|
||||
|
||||
{isLoading && <p>Loading video info...</p>}
|
||||
|
||||
{error && <p className="text-red-500">Error: {error?.error}</p>}
|
||||
|
||||
{videoInfo && (
|
||||
<div className="mt-4">
|
||||
<h2 className="text-xl font-semibold">{videoInfo.title}</h2>
|
||||
{videoInfo.thumbnail && (
|
||||
<img src={videoInfo.thumbnail} alt={videoInfo.title} className="mt-2 max-w-md" />
|
||||
)}
|
||||
<p className="mt-2">Duration: {videoInfo.duration}s</p>
|
||||
|
||||
<h3 className="mt-4 font-semibold">Available Video Qualities:</h3>
|
||||
<ul>
|
||||
{videoInfo.video_resolutions?.map((res) => (
|
||||
<li key={res}>{res}</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<h3 className="mt-4 font-semibold">Available Audio Qualities:</h3>
|
||||
<ul>
|
||||
{videoInfo.audio_resolutions?.map((res) => (
|
||||
<li key={res}>{res}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user