const bcrypt = require('bcrypt');
import {saltRounds} from "../../utils/constans/signUp";

module.exports = (req, res, next) => {

    if(req.body.password) {
        bcrypt.hash(req.body.password, saltRounds, (err, hash) => {
            if(err) {
                next(err);
            }
            req.body.password = hash;
            next();
        });
    }else {
        next();
    }
};