🚀 feat(API): add BuildStatusTypeAPI to API types and implement getBuildStatus function

The BuildStatusTypeAPI was added to the API types to support the new getBuildStatus function. The getBuildStatus function retrieves the build status of a flow by making a GET request to the server. This function is useful for updating the UI with the current status of a flow.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-12 17:03:54 -03:00
commit d381228b83

View file

@ -1,4 +1,8 @@
import { PromptTypeAPI, errorsTypeAPI } from "./../../types/api/index"; import {
BuildStatusTypeAPI,
PromptTypeAPI,
errorsTypeAPI,
} from "./../../types/api/index";
import { APIObjectType, sendAllProps } from "../../types/api/index"; import { APIObjectType, sendAllProps } from "../../types/api/index";
import axios, { AxiosResponse } from "axios"; import axios, { AxiosResponse } from "axios";
import { FlowType } from "../../types/flow"; import { FlowType } from "../../types/flow";
@ -40,6 +44,8 @@ export async function getExamples(): Promise<FlowType[]> {
return await Promise.all(contentsPromises); return await Promise.all(contentsPromises);
} }
export async function postBuild(flow: FlowType) { export async function getBuildStatus(
return await axios.post(`/build/${flow.id}`, flow); flowId: string
): Promise<BuildStatusTypeAPI> {
return await axios.get(`/build/${flowId}/status`);
} }