Files
PantryHub/middleware/auth.js
T
jurgenr c07d503d83 Werk hoofdapplicatie bij
Legt de bestaande wijzigingen in de hoofdworktree vast voordat de laatste worktree wordt gemerged.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-07 20:45:36 +02:00

18 lines
281 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();
};