Merge pull request #332 from Jac-Zac/main

Fixing username not updating
This commit is contained in:
Keith Stevens
2023-01-04 12:09:42 +09:00
committed by GitHub
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -7,6 +7,7 @@ import React, { useState } from "react";
export default function Account() {
const { data: session } = useSession();
const [username, setUsername] = useState("");
const updateUser = async (e: React.SyntheticEvent) => {
e.preventDefault();
try {
@@ -16,6 +17,7 @@ export default function Account() {
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
session.user.name = username;
await Router.push("/account");
} catch (error) {
console.error(error);
+1
View File
@@ -1,4 +1,5 @@
import { getSession } from "next-auth/react";
import prisma from "../../lib/prismadb";
// POST /api/post
// Required fields in body: title