refactor: Only return JSON for flow export

This commit is contained in:
Faruk AYDIN
2025-01-13 12:14:16 +01:00
parent 51291889cd
commit f15d1ac7b1
4 changed files with 11 additions and 86 deletions

View File

@@ -1,9 +1,11 @@
import { renderObject } from '../../../../helpers/renderer.js';
export default async (request, response) => {
const flow = await request.currentUser.authorizedFlows
.findById(request.params.flowId)
.throwIfNotFound();
const { exportedFlowAsString, slug } = await flow.export();
const exportedFlow = await flow.export();
response.status(201).attachment(slug).send(exportedFlowAsString);
return renderObject(response, exportedFlow, { status: 201 });
};