chore(frontend): Refactoring

Refactoring zodat de structuur van de authenticatieservice in de client duidelijker is.
This commit is contained in:
Gerald Schmittinger 2025-03-02 21:02:17 +01:00
parent a28ec22f29
commit 26d5c09bb4
19 changed files with 215 additions and 183 deletions

View file

@ -1,5 +1,6 @@
import express from 'express'
import {getFrontendAuthConfig} from "../controllers/auth";
import {authenticatedOnly, studentsOnly, teachersOnly} from "../middleware/auth/auth";
const router = express.Router();
// returns auth configuration for frontend
@ -7,4 +8,16 @@ router.get('/config', (req, res) => {
res.json(getFrontendAuthConfig());
});
router.get('/testAuthenticatedOnly', authenticatedOnly, (req, res) => {
res.json({message: "If you see this, you should be authenticated!"});
});
router.get('/testStudentsOnly', studentsOnly, (req, res) => {
res.json({message: "If you see this, you should be a student!"});
});
router.get('/testTeachersOnly', teachersOnly, (req, res) => {
res.json({message: "If you see this, you should be a teacher!"});
});
export default router;