sdy

update createAccout resolver

import { prisma } from "../../../middlewares";
import { prisma } from "../../../utils";
import bcrypt from "bcryptjs";
import jwt from "jsonwebtoken";
export default {
Mutation: {
createAccount: async (_, args) => {
const { name, email, bio = "", avatarUrl = "" } = args;
const { name, password, email, bio = "", avatarUrl = "" } = args;
const encryptPw = await bcrypt.hash(password, 10);
const user = await prisma.user.create({
data: {
name,
email,
bio,
avatarUrl,
password: encryptPw,
},
});
return user;
const token = jwt.sign({
id: user.id,
});
return { token, user };
},
},
};
......