2019-09-13 14:54:21 +02:00
|
|
|
const { currentSearchRequest } = require("../helpers/url");
|
2019-06-03 10:34:59 +02:00
|
|
|
|
|
|
|
|
const getUnsubscribe = async (req, res) => {
|
2019-09-05 11:14:54 +02:00
|
|
|
const title = "Uspješno ste se odjavili";
|
2019-09-13 14:54:21 +02:00
|
|
|
const searchRequest = await currentSearchRequest(req);
|
2019-10-15 21:50:23 +02:00
|
|
|
|
|
|
|
|
if (!searchRequest || !searchRequest.dataValues) {
|
|
|
|
|
res.render("notFound", { title: " " });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-13 14:54:21 +02:00
|
|
|
searchRequest.subscribed = false;
|
2019-11-05 14:19:56 +01:00
|
|
|
searchRequest.deletedEmail = searchRequest.email;
|
|
|
|
|
searchRequest.email = "";
|
2019-09-13 14:54:21 +02:00
|
|
|
await searchRequest.save();
|
2019-07-11 14:25:38 +02:00
|
|
|
|
2019-09-05 11:14:54 +02:00
|
|
|
res.render("unsubscribe", { nextStep: "/vrstanekretnine", title });
|
2019-06-03 10:34:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
2019-09-05 11:14:54 +02:00
|
|
|
getUnsubscribe
|
|
|
|
|
};
|