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);