Login start

This commit is contained in:
Riccardo
2021-01-01 10:48:54 +01:00
parent bccea7574a
commit e87431f64b
13 changed files with 452 additions and 41 deletions

Binary file not shown.

View File

@@ -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);