From 738d8c4b5b72d3552be6ae7437244825f265836f Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Sun, 6 Feb 2022 16:29:55 -0800 Subject: [PATCH] log out working now, although buggy --- .../web/components/MainTabsOrPages/Header.tsx | 65 +++++++++++-------- packages/web/pages/s/index.tsx | 2 +- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/packages/web/components/MainTabsOrPages/Header.tsx b/packages/web/components/MainTabsOrPages/Header.tsx index b2c915e..164b556 100644 --- a/packages/web/components/MainTabsOrPages/Header.tsx +++ b/packages/web/components/MainTabsOrPages/Header.tsx @@ -16,6 +16,9 @@ import MainLogo from "../Logo/MainLogo"; import UserStatusBubble from "../UserDetails/UserStatusBubble"; import { useAuth } from "../../contexts/authContext"; import { nirvanaUserDataAtom } from "../../recoil/main"; +import { getAuth, signOut } from "firebase/auth"; + +const auth = getAuth(); export default function Header() { const { currUser } = useAuth(); @@ -23,32 +26,6 @@ export default function Header() { const router = useRouter(); - const UserMenu = ( - - router.push("/teams/profile")} - icon={} - > - - - - window.open("/teams", "_self")} - key={"team hub"} - icon={} - > - - - - - - console.log("sign out")}> - - - - ); - const inputRef = useRef(); const [searchInput, setSearchInput] = useState(""); @@ -77,6 +54,42 @@ export default function Header() { }); }; + const logOut = async () => { + // setLoading(true); + + console.log("logging user out"); + + router.push("/"); + + await signOut(auth); + }; + + const UserMenu = ( + + router.push("/teams/profile")} + icon={} + > + + + + window.open("/teams", "_self")} + key={"team hub"} + icon={} + > + + + + + + + + + + ); + const keyMap: KeyMap = { SELECT_SEARCH: { name: "select search to start searching", diff --git a/packages/web/pages/s/index.tsx b/packages/web/pages/s/index.tsx index faf6300..670977b 100644 --- a/packages/web/pages/s/index.tsx +++ b/packages/web/pages/s/index.tsx @@ -99,7 +99,7 @@ export default function Me() { case QueryRoutes.drawer: return ; default: - return <>; + return ; } }