diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-03-12 14:06:25 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-03-12 14:06:25 -0400 |
| commit | 46a0ba30ef54a7e36206481a4f5b2bf1f9702fca (patch) | |
| tree | a95fd534fc27761d8b26d0dffcdb5f300f7a61c7 /backend/src/resolvers/Mutation.js | |
| parent | f7bea2d1b7be2b70dceb25c9837f608b538e9cec (diff) | |
wip
Diffstat (limited to 'backend/src/resolvers/Mutation.js')
| -rw-r--r-- | backend/src/resolvers/Mutation.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/backend/src/resolvers/Mutation.js b/backend/src/resolvers/Mutation.js index b0afc6d..cd25599 100644 --- a/backend/src/resolvers/Mutation.js +++ b/backend/src/resolvers/Mutation.js @@ -31,7 +31,6 @@ const mutations = { if (!valid) { throw new Error('Invalid password'); } - return { token: jwt.sign({ userId: user.id }, process.env.APP_SECRET), user, @@ -322,6 +321,16 @@ const mutations = { // 4. Send an email with their order // 5. Send the order back }, + async updateUser(parent, args, ctx, info) { + const userId = getUserId(ctx); + console.log(userId); + const updatedUser = await ctx.db.mutation.updateUser({ + data: args, + where: { id: userId }, + }); + console.log(updatedUser); + return updatedUser; + }, }; module.exports = mutations; |
