diff --git a/modules/auth/auth.controller.js b/modules/auth/auth.controller.js index 33cd90d..9b83cd8 100644 --- a/modules/auth/auth.controller.js +++ b/modules/auth/auth.controller.js @@ -78,7 +78,9 @@ async function register(req, res, next) { } }; - newUser = cleanAdminData(newUser.toJSON()); + if (newUser) + newUser = cleanAdminData(newUser.toJSON()); + newUser.token = tokens.token; console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); console.log(newUser);