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;