added roles with checking in middleware
- still need signup for orgs - login for admin
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
const express = require('express'),
|
||||
router = express.Router(),
|
||||
checkAuth = require('../middleware/check-auth');
|
||||
checkAuth = require('../middleware/check-auth'),
|
||||
roles = require('../helpers/roles');
|
||||
|
||||
const auth = require('../controllers/auth.controller.js');
|
||||
|
||||
// Check database for donor
|
||||
router.post('/donor/login', auth.login);
|
||||
// Check database for donor and get token with donor role
|
||||
router.post('/donor/login', auth.login('donor', roles.DONOR));
|
||||
|
||||
// Check database for org and get token with org role
|
||||
router.post('/org/login', auth.login('org', roles.ORGANIZATION));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user