D3V-Server/backend/lib/express/user-id-from-me.js

9 lines
247 B
JavaScript
Raw Permalink Normal View History

2026-03-07 13:49:44 +00:00
export default (req, res, next) => {
if (req.params.user_id === 'me' && res.locals.access) {
req.params.user_id = res.locals.access.token.get('attrs').id;
} else {
req.params.user_id = Number.parseInt(req.params.user_id, 10);
}
next();
};