From 56ab7a3062c5fafb40f7fa68afe83640aa4c952e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 9 Jun 2024 01:08:04 +0530 Subject: [PATCH] feat: get active workflow --- src/api/workflow.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/api/workflow.ts diff --git a/src/api/workflow.ts b/src/api/workflow.ts new file mode 100644 index 00000000..ab89675c --- /dev/null +++ b/src/api/workflow.ts @@ -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 => { + 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; + } +}; +