Skip to content

Commit

Permalink
Merge pull request #294 from Klotske/fix-null-username
Browse files Browse the repository at this point in the history
#276 - Fixed null username
  • Loading branch information
fozziethebeat committed Jan 2, 2023
2 parents 245a3de + 15c0634 commit b810dfb
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions website/src/pages/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,10 @@ import { Button } from "@chakra-ui/react";
import Head from "next/head";
import Link from "next/link";
import { useSession } from "next-auth/react";
import React, { useState } from "react";
import React 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;
Expand All @@ -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>
Expand Down

0 comments on commit b810dfb

Please sign in to comment.