Files
old-web/app/controllers/prices.js

24 lines
529 B
JavaScript
Raw Normal View History

2019-05-17 11:32:41 +02:00
const { currentRERequest } = require('../helpers/url');
2019-05-19 02:14:20 +02:00
const { prices } = require('../helpers/enums');
2019-05-17 11:32:41 +02:00
const getPrice = (req,res) => {
const nextStep = req.query.nextStep;
res.render('price', {
nextStep,
prices
});
};
const postPrice = async (req, res) => {
const request = await currentRERequest(req);
2019-05-19 12:29:55 +02:00
const nextStep = req.query.nextStep || `/pregled/${request.uniqueId}`;
2019-05-17 11:32:41 +02:00
request.price = req.body.price;
await request.save();
2019-05-19 12:29:55 +02:00
res.redirect(nextStep);
2019-05-17 11:32:41 +02:00
};
module.exports = {
getPrice,
postPrice
};