Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-04-19 16:13:10 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1c37ea517e48bd07b3fac1a38362dca010a92190
1c37ea51
1 parent
2cb00556
update createAccout resolver
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
back/src/api/User/createAccount/createAccount.js
back/src/api/User/createAccount/createAccount.js
View file @
1c37ea5
import
{
prisma
}
from
"../../../middlewares"
;
import
{
prisma
}
from
"../../../utils"
;
import
bcrypt
from
"bcryptjs"
;
import
jwt
from
"jsonwebtoken"
;
export
default
{
Mutation
:
{
createAccount
:
async
(
_
,
args
)
=>
{
const
{
name
,
email
,
bio
=
""
,
avatarUrl
=
""
}
=
args
;
const
{
name
,
password
,
email
,
bio
=
""
,
avatarUrl
=
""
}
=
args
;
const
encryptPw
=
await
bcrypt
.
hash
(
password
,
10
);
const
user
=
await
prisma
.
user
.
create
({
data
:
{
name
,
email
,
bio
,
avatarUrl
,
password
:
encryptPw
,
},
});
return
user
;
const
token
=
jwt
.
sign
({
id
:
user
.
id
,
});
return
{
token
,
user
};
},
},
};
...
...
Please
register
or
login
to post a comment