check if export has been set, if not return

This commit is contained in:
kukulaka
2020-09-02 16:07:01 +01:00
parent ec8d2baf17
commit 60eed400ea

View File

@@ -1,5 +1,6 @@
import { RequestHandler } from 'express';
import asyncHandler from 'express-async-handler';
import fs from 'fs';
/**
* middleware to manage actions on responses such as
@@ -9,6 +10,18 @@ import asyncHandler from 'express-async-handler';
*/
const responseManager: RequestHandler = asyncHandler(async (req, res, next) => {
if (!req.query.export) return next();
const exportType = req.query.export;
if (exportType === 'json') {
// have chose to export json
}
if (exportType === 'csv') {
// have chosen to export csv
}
return next();
});