Voegt boodschappenlijsten, productbeheer, realtime synchronisatie en browsercache-updates toe. Herstelt login- en sessiegedrag en maakt database-seeding herhaalbaar.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
17 lines
280 B
JavaScript
17 lines
280 B
JavaScript
module.exports = function(req, res, next) {
|
|
|
|
|
|
if (!req.session.userId) {
|
|
|
|
if (req.originalUrl.startsWith("/api/")) {
|
|
return res.status(401).json({ error: "Je bent niet ingelogd" });
|
|
}
|
|
|
|
return res.redirect("/login");
|
|
|
|
}
|
|
|
|
|
|
next();
|
|
|
|
}; |