skip to query review directly when editing data

This commit is contained in:
Bilal Catic
2019-05-21 15:25:28 +02:00
parent 126da48852
commit aa3c965d5c
7 changed files with 74 additions and 57 deletions

View File

@@ -2,19 +2,19 @@ const { currentRERequest } = require('../helpers/url');
const { sizes } = require('../helpers/enums');
const getSize = (req,res) => {
const nextStep = req.query.nextStep;
res.render('size', {
nextStep,
sizes
});
res.render('size', { sizes });
};
const postSize = async (req, res) => {
const request = await currentRERequest(req);
const nextStep = req.query.nextStep || `/okucnica/${request.uniqueId}`;
const nextStepPage = req.query.nextStep || 'okucnica';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
request.size = req.body.size;
await request.save();
res.redirect(nextStep);
res.redirect(nextStepUrl);
};
module.exports = {