Download the new process in json file
This commit is contained in:
parent
23a3b2a9e8
commit
c5b58d999f
@ -53,6 +53,19 @@ export async function getProcessCreation(container: HTMLElement) {
|
|||||||
|
|
||||||
const approveChangeResult = await service.approveChange(processId, stateId);
|
const approveChangeResult = await service.approveChange(processId, stateId);
|
||||||
await service.handleApiReturn(approveChangeResult);
|
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);
|
container.appendChild(btn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user