Add name change functionality to user settings. Update SettingsPasswordForm to handle name updates, including validation and error handling. Fetch current user name for display in settings page.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m44s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m44s
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { auth } from "@/auth";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { SettingsPasswordForm } from "@/components/SettingsPasswordForm";
|
||||
|
||||
export default async function SettingsPage() {
|
||||
const session = await auth();
|
||||
if (!session?.user) redirect("/auth/login");
|
||||
if (!session?.user?.id) redirect("/auth/login");
|
||||
|
||||
return <SettingsPasswordForm />;
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: session.user.id },
|
||||
select: { name: true },
|
||||
});
|
||||
|
||||
return <SettingsPasswordForm currentName={user?.name ?? ""} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user