Changed editing redirection.

This commit is contained in:
Naida Vatric
2020-03-20 15:40:38 +01:00
parent 55cb01c3c2
commit 60f74c2cde
7 changed files with 54 additions and 7 deletions

View File

@@ -0,0 +1,8 @@
const editSuccess = async (req, res) => {
const title = "Uspjeh!";
res.render("editSuccess", { title });
};
module.exports = {
editSuccess
};

View File

@@ -203,8 +203,11 @@ const postPublishInputs = async (req, res) => {
return;
}
const nextStepPage = req.query.nextStep || "/uspjesnaobjava";
const editingRealEstate = req.body.editingRealEstate;
const nextStepPage = editingRealEstate
? req.query.nextStep || "/uspjesnaizmjena"
: req.query.nextStep || "/uspjesnaobjava";
//Request body
//console.log("Body:", req.body);
@@ -334,9 +337,15 @@ const postPublishInputs = async (req, res) => {
await kiviOriginal.save();
//Calling function to notify real estate owner that ads is published on Kivi page after 1 sec
setTimeout(notifyForNewAdPublish, 1000, realEstate, kiviOriginal);
//Calling function to notify users of new real estate after 2 min
//Calling function to notify real estate owner that ads is published or edited on Kivi page after 1 sec
setTimeout(
notifyForNewAdPublish,
1000,
realEstate,
kiviOriginal,
editingRealEstate
);
//Calling function to notify users of new real estate (or edited realestate) after 2 min
setTimeout(notifyForNewRealEstates, 1000 * 60 * 2, [realEstate]);
res.redirect(nextStepPage);