-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for user info in lib and settings
- Loading branch information
1 parent
79c86a2
commit f6009b3
Showing
4 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,17 +11,36 @@ import { | |
import { IoArrowBack as ArrowBack } from "react-icons/io5"; | ||
import { useRouter } from "next/router"; | ||
import { NextSeo } from "next-seo"; | ||
import { useClerk } from "@clerk/clerk-react"; | ||
import { supabaseClient } from "../lib/client"; | ||
import { useEffect, useState } from "react"; | ||
|
||
export default function Settings() { | ||
const router = useRouter(); | ||
const [name, setName] = useState(""); | ||
const [email, setEmail] = useState(""); | ||
|
||
const user = supabaseClient.auth.user(); | ||
|
||
const values = { | ||
name: "Alyssa", | ||
email: "[email protected]", | ||
}; | ||
|
||
useEffect(() => { | ||
if (user) { | ||
supabaseClient | ||
.from("profiles") | ||
.select("*") | ||
.eq("id", user.id) | ||
.then(({ data, error }) => { | ||
if (!error) { | ||
setName(data[0].first_name || ""); | ||
setEmail(data[0].email || ""); | ||
} | ||
}); | ||
} | ||
}, [user]); | ||
|
||
return ( | ||
<div className="flex h-full w-screen"> | ||
<NextSeo | ||
|
@@ -56,7 +75,7 @@ export default function Settings() { | |
type={"name"} | ||
placeholder="Name" | ||
readOnly | ||
value={values.name} | ||
value={name} | ||
/> | ||
</InputGroup> | ||
</FormControl> | ||
|
@@ -69,7 +88,7 @@ export default function Settings() { | |
type={"email"} | ||
placeholder="Email" | ||
readOnly | ||
value={values.email} | ||
value={email} | ||
/> | ||
</InputGroup> | ||
</FormControl> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f6009b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks for Deployment have failed