add fetch() to create()

pull/13/head
unknown 2018-10-31 16:48:09 -04:00
parent 7774197a7e
commit 0cdca62c36
2 changed files with 3 additions and 2 deletions

View File

@ -111,7 +111,7 @@ function PassportHelper () {
if (!req.user) {
if (!passport) { // new user signing up, create a new user
user = await User.create(userAttrs)
user = await User.create(userAttrs).fetch()
await Passport.create({
...q,
user: user.id

View File

@ -43,9 +43,10 @@ module.exports.protocols = {
try {
const token = generateToken()
const password = user.password
if (!password.length) throw new Error('password cannot be blank')
delete user.password
const newUser = User.create(user)
const newUser = await User.create(user).fetch()
try {
await Passport.create({
protocol: 'local',