Files
old-web/app/controllers/prices.js
2019-05-21 15:32:47 +02:00

24 lines
521 B
JavaScript

const { currentRERequest } = require('../helpers/url');
const { prices } = require('../helpers/enums');
const getPrice = (req,res) => {
res.render('price', { prices });
};
const postPrice = async (req, res) => {
const request = await currentRERequest(req);
const nextStepPage = req.query.nextStep || 'pregled';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
request.price = req.body.price;
await request.save();
res.redirect(nextStepUrl);
};
module.exports = {
getPrice,
postPrice
};