UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

35 lines (32 loc) 1.39 kB
import { getActiveJourneyValue } from '../../../../../../utils/sessionHelper.js'; import localsHelper from '../../../../../../utils/localsHelper.js'; class RequestDownloadSubmittedController { layoutPath; services; constructor(layoutPath, services) { this.layoutPath = layoutPath; this.services = services; } GET = async (req, res, _next) => { const { dprUser } = localsHelper.getValues(res); const { reportId, variantId, tableId } = req.params; const { reportName, variantName } = req.query; const currentReportUrl = getActiveJourneyValue(req, { id: variantId, reportId, tableId }, 'currentReportUrl'); let reportHref = currentReportUrl; if (reportHref) { reportHref = reportHref.replaceAll('/download-disabled', ''); } await this.services.downloadPermissionService.saveDownloadPermissionData(dprUser.id, reportId, variantId); res.render(`dpr/routes/journeys/download-report/request-download/form/submitted/view`, { title: 'success', layoutPath: this.layoutPath, report: { reportName, variantName, reportHref, }, }); }; } export { RequestDownloadSubmittedController, RequestDownloadSubmittedController as default }; //# sourceMappingURL=controller.js.map