Login start
This commit is contained in:
Binary file not shown.
@@ -2,20 +2,33 @@ const bcrypt = require('bcryptjs');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const { APP_SECRET } = require('../utils');
|
||||
|
||||
async function post(parent, args, context, info) {
|
||||
function post(parent, args, context, info) {
|
||||
const { userId } = context;
|
||||
|
||||
const newLink = await context.prisma.link.create({
|
||||
const newLink = context.prisma.link.create({
|
||||
data: {
|
||||
url: args.url,
|
||||
description: args.description,
|
||||
postedBy: { connect: { id: userId } }
|
||||
}
|
||||
});
|
||||
context.pubsub.publish('NEW_LINK', newLink);
|
||||
|
||||
return newLink;
|
||||
}
|
||||
// async function post(parent, args, context, info) {
|
||||
// const { userId } = context;
|
||||
|
||||
// const newLink = await context.prisma.link.create({
|
||||
// data: {
|
||||
// url: args.url,
|
||||
// description: args.description,
|
||||
// postedBy: { connect: { id: userId } }
|
||||
// }
|
||||
// });
|
||||
// context.pubsub.publish('NEW_LINK', newLink);
|
||||
|
||||
// return newLink;
|
||||
// }
|
||||
|
||||
async function signup(parent, args, context, info) {
|
||||
const password = await bcrypt.hash(args.password, 10);
|
||||
|
||||
Reference in New Issue
Block a user