Add update-event for winners/attendees

This commit is contained in:
Kasper Rynning-Tønnesen
2020-03-13 17:13:04 +01:00
parent 3f832da6db
commit 35e736a9d9
2 changed files with 6 additions and 1 deletions

View File

@@ -21,11 +21,13 @@ router.use((req, res, next) => {
router.route("/winners").delete(mustBeAuthenticated, async (req, res) => {
await VirtualWinner.deleteMany();
io.emit("refresh_data", {});
res.json(true);
});
router.route("/attendees").delete(mustBeAuthenticated, async (req, res) => {
await Attendee.deleteMany();
io.emit("refresh_data", {});
res.json(true);
});

View File

@@ -99,7 +99,10 @@ export default {
this.currentWinnerDrawn = false;
}, 15000);
});
this.socket.on("refresh_data", async msg => {
this.getAttendees();
this.getWinners();
});
this.socket.on("new_attendee", async msg => {
this.getAttendees();
});