webapp-deployment-status-ui/src/utils/data-utils.ts
2024-02-16 01:50:35 +00:00

23 lines
539 B
TypeScript

const baseUrl = "https://webapp-deployer-api.apps.snowballtools.com";
export const fetchAllStatuses = async () => {
const res = await fetch(baseUrl);
if (!res.ok) {
throw new Error('Network response was not ok')
}
return await res.json();
}
export const fetchLogs = async (id: string) => {
if (!id) {
return "";
}
let url = `${baseUrl}/log/${id}`
const res = await fetch(url);
if (!res.ok) {
throw new Error('Network response was not ok')
}
return await res.text();
}