Skip to content

Commit 27f7f6a

Browse files
committed
(chore) - add authorization header to post
1 parent d2a3ac8 commit 27f7f6a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

server/src/resolvers/Mutation.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ const bcrypt = require('bcryptjs')
22
const jwt = require('jsonwebtoken')
33
const { APP_SECRET, getUserId } = require('../utils')
44

5-
function post(parent, args, context) {
5+
function post(parent, { url, description }, context) {
6+
const userId = getUserId(context)
67
return context.prisma.createLink({
7-
url: args.url,
8-
description: args.description,
8+
url,
9+
description,
10+
postedBy: {
11+
connect: {
12+
id: userId
13+
}
14+
}
915
})
1016
}
1117

0 commit comments

Comments
 (0)