feat: get active workflow
This commit is contained in:
19
src/api/workflow.ts
Normal file
19
src/api/workflow.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { WhereWhatPair, WorkflowFile } from "@wbr-project/wbr-interpret";
|
||||
import { emptyWorkflow } from "../shared/constants";
|
||||
|
||||
const axios = require('axios').default;
|
||||
|
||||
export const getActiveWorkflow = async(id: string) : Promise<WorkflowFile> => {
|
||||
try {
|
||||
const response = await axios.get(`http://localhost:8080/workflow/${id}`)
|
||||
if (response.status === 200) {
|
||||
return response.data;
|
||||
} else {
|
||||
throw new Error('Something went wrong when fetching a recorded workflow');
|
||||
}
|
||||
} catch(error: any) {
|
||||
console.log(error);
|
||||
return emptyWorkflow;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user