skip to query review directly when editing data
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
const { currentRERequest } = require('../helpers/url');
|
||||
const { currentRERequest } = require('../helpers/url');
|
||||
const { getRegions } = require('../helpers/codes');
|
||||
|
||||
const regions = getRegions();
|
||||
|
||||
const getRegion = (req,res) => {
|
||||
const nextStep = req.query.nextStep || '/';
|
||||
res.render('region', {
|
||||
nextStep,
|
||||
regions
|
||||
});
|
||||
res.render('region', { regions });
|
||||
};
|
||||
|
||||
const postRegion = async (req, res) => {
|
||||
const request = await currentRERequest(req);
|
||||
const nextStep = req.query.nextStep || `/mjesto/${request.uniqueId}`;
|
||||
|
||||
const nextStepQueryParam = req.query.nextStep ? '?nextStep=pregled' : '';
|
||||
const nextStepPage = req.query.nextStep || 'mjesto';
|
||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}${nextStepQueryParam}`;
|
||||
|
||||
request.region = req.body.region;
|
||||
request.municipality = null;
|
||||
await request.save();
|
||||
res.redirect(nextStep)
|
||||
|
||||
res.redirect(nextStepUrl)
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user