adding a display name on auth user
This commit is contained in:
parent
3307601fbc
commit
f15d452782
2 changed files with 40 additions and 16 deletions
|
|
@ -13,6 +13,20 @@ function Hero() {
|
|||
cursor.style.top = `${e.clientY}px`;
|
||||
}
|
||||
};
|
||||
async function fetchUser() {
|
||||
const res = await fetch("http://localhost:3000/api/current_user", {
|
||||
credentials: "include", // very important
|
||||
});
|
||||
if (res.ok) {
|
||||
const user = await res.json();
|
||||
console.log("User display name:", user.displayName);
|
||||
|
||||
setUser(user);
|
||||
} else {
|
||||
setUser(null);
|
||||
}
|
||||
}
|
||||
fetchUser();
|
||||
|
||||
window.addEventListener("mousemove", handleMouseMove);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue