updated avatar component name, added ability to change username (only works server side for now), updated signin page, updated Footer

Still working on the account settings page but didn't want to get behind on commits.
This commit is contained in:
rsandb
2022-12-27 13:00:32 -06:00
parent afe95102f9
commit de869033bf
12 changed files with 231 additions and 92 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import type { AuthOptions } from "next-auth";
import NextAuth from "next-auth";
import { NextApiHandler } from "next";
import DiscordProvider from "next-auth/providers/discord";
import EmailProvider from "next-auth/providers/email";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
@@ -37,7 +38,7 @@ export const authOptions: AuthOptions = {
adapter: PrismaAdapter(prisma),
providers,
pages: {
signIn: "/auth/signup",
signIn: "/auth/signin",
verifyRequest: "/auth/verify",
// error: "/auth/error", -Will be used later
},
+22
View File
@@ -0,0 +1,22 @@
import { getSession } from "next-auth/react";
import { Prisma } from "@prisma/client";
import Email from "next-auth/providers/email";
// POST /api/post
// Required fields in body: title
// Optional fields in body: content
export default async function handle(req, res) {
const { username } = req.body;
const { email } = req.body;
const session = await getSession({ req });
const result = await prisma.user.update({
where: {
email: session?.user?.email,
},
data: {
name: username,
},
});
res.json({ name: result.name });
}