fix(frontend): logout state not shown after JWT expires (#40)
Reviewed-on: #40
This commit was merged in pull request #40.
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import type { APIResponse, JobResponse } from "../types.ts";
|
||||
import { API_URL } from "./client.ts";
|
||||
import { API_URL, apiFetch, apiFetchRaw } 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();
|
||||
const result = await apiFetch<APIResponse>(API_URL + `/api/v1/jobs/${uuid}`);
|
||||
if (result.status === 'error') throw new Error(`Failed to fetch job: ${result.message}`);
|
||||
|
||||
return result.data;
|
||||
};
|
||||
|
||||
export { getJob };
|
||||
const downloadJob = async (uuid: string): Promise<Blob> => {
|
||||
const response = await apiFetchRaw(API_URL + `/api/v1/jobs/${uuid}/download`);
|
||||
return response.blob();
|
||||
};
|
||||
|
||||
export { getJob, downloadJob };
|
||||
|
||||
Reference in New Issue
Block a user