refactor(frontend): split endpoint handling

This commit is contained in:
2026-07-02 19:46:19 +01:00
parent fe735faba8
commit e0969a1d78
21 changed files with 366 additions and 369 deletions

View File

@@ -0,0 +1,15 @@
import type { APIResponse, JobResponse } from "../types.ts";
import { API_URL } from "./client.ts";
const getJob = async (uuid: string): Promise<JobResponse> => {
const response = await fetch(API_URL + `/api/v1/jobs/${uuid}`, { credentials: 'include' });
if (!response.ok) throw new Error(`Failed to fetch job: ${response.status}`);
const result: APIResponse = await response.json();
if (result.status === 'error') throw new Error(`Failed to fetch job: ${result.message}`);
return result.data;
};
export { getJob };