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

24 lines
521 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) => {
res.render('price', { prices });
2019-05-17 11:32:41 +02:00
};
const postPrice = async (req, res) => {
const request = await currentRERequest(req);
const nextStepPage = req.query.nextStep || 'pregled';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
2019-05-17 11:32:41 +02:00
request.price = req.body.price;
await request.save();
res.redirect(nextStepUrl);
2019-05-17 11:32:41 +02:00
};
module.exports = {
getPrice,
postPrice
};