From c5b58d999fb89716d437439fbc994377d1bdf905 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Thu, 5 Jun 2025 15:39:33 +0200 Subject: [PATCH] Download the new process in json file --- src/pages/account/process-creation.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/pages/account/process-creation.ts b/src/pages/account/process-creation.ts index 8ac747d..632adca 100644 --- a/src/pages/account/process-creation.ts +++ b/src/pages/account/process-creation.ts @@ -53,6 +53,19 @@ export async function getProcessCreation(container: HTMLElement) { const approveChangeResult = await service.approveChange(processId, stateId); await service.handleApiReturn(approveChangeResult); + if (approveChangeResult) { + const process = await service.getProcess(processId); + const newState = service.getStateFromId(process, stateId); + const blob = new Blob([JSON.stringify(newState, null, 2)], { type: 'application/json' }); + const url = URL.createObjectURL(blob); + + const a = document.createElement('a'); + a.href = url; + a.download = `process_${processId}_${stateId}.json`; + a.click(); + + URL.revokeObjectURL(url); // Clean up + } }; container.appendChild(btn);