Files
artcraft/app/hooks/useActiveJobs/utilities.ts
T
wilandwil c1c500863f Api2.6 & Fix/ Cancel Audio generation jobs (#536)
- update the audio inference component to use api manager to cancel job
- update the audio inference component to reflect more job statuses

---------

Co-authored-by: wil <wil@storyteller.ai>
2024-06-27 18:17:18 -04:00

18 lines
511 B
TypeScript

import { ToastTypes } from "~/enums";
import { addToast, setJobs } from "~/signals";
import { JobsApi } from "~/Classes/ApiManager/JobsApi";
export async function PollRecentJobs() {
const jobsApi = new JobsApi();
const response = await jobsApi.ListRecentJobs();
if (response.success && response.data) {
setJobs(response.data);
// else, just no jobs, not an error, do nothing
return;
}
addToast(
ToastTypes.ERROR,
response.errorMessage || "Unknown Error: List Recent Jobs",
);
}