12 lines
365 B
JavaScript
12 lines
365 B
JavaScript
const profileService = require('../services/profileService');
|
|
|
|
async function redirectIfMissingProfileDetailsMiddleware(req, res, next) {
|
|
const publicKey = req.cookies.publicKey;
|
|
if (!(await profileService.areProfileDetailsComplete(publicKey))) {
|
|
res.redirect('/createProfile');
|
|
}
|
|
|
|
next();
|
|
}
|
|
|
|
module.exports = redirectIfMissingProfileDetailsMiddleware;
|