sdy

update createAccount

1 -import { prisma } from "../../../utils"; 1 +import { prisma, generateToken } from "../../../utils";
2 import bcrypt from "bcryptjs"; 2 import bcrypt from "bcryptjs";
3 -import jwt from "jsonwebtoken";
4 3
5 export default { 4 export default {
6 Mutation: { 5 Mutation: {
...@@ -16,12 +15,7 @@ export default { ...@@ -16,12 +15,7 @@ export default {
16 password: encryptPw, 15 password: encryptPw,
17 }, 16 },
18 }); 17 });
19 - const token = jwt.sign( 18 + const token = generateToken(user.id);
20 - {
21 - id: user.id,
22 - },
23 - process.env.JWT_SECRET
24 - );
25 return { token, user }; 19 return { token, user };
26 }, 20 },
27 }, 21 },
......