diff --git a/next/src/pages/workflow/[workflow].tsx b/next/src/pages/workflow/[workflow].tsx index 9f4e6ecd18..63ec22540f 100644 --- a/next/src/pages/workflow/[workflow].tsx +++ b/next/src/pages/workflow/[workflow].tsx @@ -18,6 +18,16 @@ const WorkflowPage: NextPage = () => { const { session } = useAuth({ protectedRoute: true }); const { query } = useRouter(); + const handleClick = async () => { + try { + await saveWorkflow(); + window.alert('Workflow saved successfully!'); + } catch (error) { + window.alert('An error occurred while saving the workflow. ' + error); + } + }; + + const { nodesModel, edgesModel, selectedNode, saveWorkflow, createNode, updateNode, members } = useWorkflow(query.workflow as string, session); @@ -53,9 +63,7 @@ const WorkflowPage: NextPage = () => {
} - onClick={() => { - saveWorkflow().catch(console.error); - }} + onClick={handleClick} > Save diff --git a/next/src/services/fetch-utils.ts b/next/src/services/fetch-utils.ts index 96e58ada29..b00d8e4010 100644 --- a/next/src/services/fetch-utils.ts +++ b/next/src/services/fetch-utils.ts @@ -65,7 +65,7 @@ export const put = async ( }); if (!response.ok) { - throw new Error("Request failed"); + throw new Error(response.statusText); } // eslint-disable-next-line @typescript-eslint/no-unsafe-return diff --git a/next/src/services/workflow/workflowApi.ts b/next/src/services/workflow/workflowApi.ts index dce6139f3e..683026ab4f 100644 --- a/next/src/services/workflow/workflowApi.ts +++ b/next/src/services/workflow/workflowApi.ts @@ -47,7 +47,7 @@ export default class WorkflowApi { async update(id: string, data: Workflow) { return await put( `/api/workflow/${id}`, - PresignedPostSchema, + z.any(), data, this.accessToken, this.organizationId