mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-01 16:50:12 +08:00
Use session for username, removed update handler
This commit is contained in:
@@ -6,20 +6,6 @@ import React, { useState } from "react";
|
||||
|
||||
export default function Account() {
|
||||
const { data: session } = useSession();
|
||||
const [username, setUsername] = useState("null");
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const handleUpdate = async () => {
|
||||
const response = await fetch("../api/update", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ username }),
|
||||
});
|
||||
const { name } = await response.json();
|
||||
setUsername(name);
|
||||
};
|
||||
|
||||
if (!session) {
|
||||
return;
|
||||
@@ -34,7 +20,7 @@ export default function Account() {
|
||||
/>
|
||||
</Head>
|
||||
<main className="h-3/4 z-0 bg-white flex flex-col items-center justify-center">
|
||||
<p>{username}</p>
|
||||
<p>{session.user.name || "No username"}</p>
|
||||
<Button>
|
||||
<Link href="/account/edit">Edit Username</Link>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user