diff options
Diffstat (limited to 'backend/src/resolvers')
| -rw-r--r-- | backend/src/resolvers/Mutation.js | 8 | ||||
| -rw-r--r-- | backend/src/resolvers/Query.js | 13 |
2 files changed, 9 insertions, 12 deletions
diff --git a/backend/src/resolvers/Mutation.js b/backend/src/resolvers/Mutation.js index 1c071fe..6349109 100644 --- a/backend/src/resolvers/Mutation.js +++ b/backend/src/resolvers/Mutation.js @@ -251,14 +251,6 @@ const mutations = { return ctx.db.mutation.deleteCartItem({ where: { id: args.id }, }); - // const userId = getUserId(ctx); - // return ctx.db.query.user({ where: { id: userId } }, '{ id, cart { id, quantity }}'); - // const cartItem = await ctx.db.query.cartItem({ - // where: { id: args.id }, - // }); - - // console.log(cartItem); - // return cartItem; }, async createOrder(parent, args, ctx, info) { const userId = getUserId(ctx); diff --git a/backend/src/resolvers/Query.js b/backend/src/resolvers/Query.js index 8649e43..2aabdb7 100644 --- a/backend/src/resolvers/Query.js +++ b/backend/src/resolvers/Query.js @@ -41,10 +41,15 @@ const Query = { return ctx.db.query.user({ where: { id } }, info); }, async orders(parent, args, ctx, info) { - console.l('--------------------FETCHING ORDERS---------------------'); - console.log(args); - return ctx.db.query.orders({}, info); - console.l('--------------------FETCHING ORDERS---------------------'); + const userId = getUserId(ctx); + return ctx.db.query.orders( + { + where: { + user: { id: userId }, + }, + }, + info + ); }, }; |
