Changed editing redirection.
This commit is contained in:
8
app/controllers/editSuccess.js
Normal file
8
app/controllers/editSuccess.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const editSuccess = async (req, res) => {
|
||||
const title = "Uspjeh!";
|
||||
res.render("editSuccess", { title });
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
editSuccess
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user