Spaces:
Sleeping
Sleeping
File size: 709 Bytes
34d0dc9 a089552 34d0dc9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | const envUrl = import.meta.env.VITE_API_URL;
export const API_URL = (envUrl !== undefined && envUrl !== null) ? envUrl : '';
export async function submitUrls(urls: string[]) {
const response = await fetch(`${API_URL}/scrape`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ urls })
});
if (!response.ok) {
throw new Error(`Submission failed: ${response.statusText}`);
}
}
export async function getJobs() {
const res = await fetch(`${API_URL}/results`);
if (!res.ok) {
throw new Error(`Failed to fetch jobs`);
}
return res.json();
}
export function getDownloadUrl() {
return `${API_URL}/download`;
}
|