don't allow going home unless profile details are complete
This commit is contained in:
parent
c38feef86f
commit
f57a20a3a3
3 changed files with 26 additions and 23 deletions
12
src/middlewares/redirectIfMissingProfileDetailsMiddleware.js
Normal file
12
src/middlewares/redirectIfMissingProfileDetailsMiddleware.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue