From 46a0ba30ef54a7e36206481a4f5b2bf1f9702fca Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Mon, 12 Mar 2018 14:06:25 -0400 Subject: wip --- backend/src/resolvers/Mutation.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'backend/src/resolvers/Mutation.js') 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; -- cgit v1.3