2025-03-05 16:13:39 +01:00
|
|
|
const profileService = require('../services/profileService');
|
2025-02-20 23:45:13 +01:00
|
|
|
|
|
|
|
|
async function redirectIfMissingProfileDetailsMiddleware(req, res, next) {
|
|
|
|
|
const publicKey = req.cookies.publicKey;
|
|
|
|
|
if (!(await profileService.areProfileDetailsComplete(publicKey))) {
|
|
|
|
|
res.redirect('/createProfile');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = redirectIfMissingProfileDetailsMiddleware;
|