clean up unused file

This commit is contained in:
Dan Ribbens
2019-09-23 20:12:04 -04:00
parent 0fb82ac152
commit d1f399be09
2 changed files with 1 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
import jwt from 'jsonwebtoken';
const passport = require('passport');
import passport from 'passport';
import httpStatus from 'http-status';
import APIError from '../lib/helpers/APIError';
@@ -13,7 +13,6 @@ export default User => ({
*/
register: (req, res, next) => {
User.register(new User({ email: req.body.email }), req.body.password, (err, user) => {
console.log(err, user);
if (err) {
const error = new APIError('Authentication error', httpStatus.UNAUTHORIZED);
return next(error);

View File

@@ -1,24 +0,0 @@
const httpStatus = require('http-status');
const passport = require('passport');
const APIError = require('../../src/lib/helpers/APIError');
module.exports = User => ({
/**
* Returns User when succesfully registered
* @param req
* @param res
* @param next
* @returns {*}
*/
post: (req, res, next) => {
User.register(new User({ email: req.body.email }), req.body.password, (err, user) => {
if (err) {
const error = new APIError('Authentication error', httpStatus.UNAUTHORIZED);
return next(error);
}
passport.authenticate('local')(req, res, () => {
res.json({ email: user.email, role: user.role, createdAt: user.createdAt });
});
});
}
});