pushing things I forgot

This commit is contained in:
Kasper Rynning-Tønnesen
2020-02-21 09:54:16 +01:00
parent 8585b85d79
commit ac1e73ee09
4 changed files with 30 additions and 3 deletions

View File

@@ -64,7 +64,11 @@ router.route("/send-notification").post(async (req, res) => {
res.send(false);
return;
}
const message = req.body.message;
const message = JSON.stringify({
message: req.body.message,
title: "Vinlotteri!"
});
let subs = await Subscription.find();
for (let i = 0; i < subs.length; i++) {
let subscription = subs[i]; //get subscription from your databse here.
@@ -80,10 +84,14 @@ schedule.scheduleJob(
let subs = await Subscription.find();
for (let i = 0; i < subs.length; i++) {
let subscription = subs[i]; //get subscription from your databse here.
const message = "Husk vinlotteriet, det begynner om 10 minutter!";
const message = JSON.stringify({
message: "Husk vinlotteriet, det begynner om 10 minutter!",
title: "Vinlotteri!"
});
sendNotification(subscription, message);
}
}
);
module.exports = router;
module.exports.sendNotification = sendNotification;