Skip to content

Commit

Permalink
Logout works now
Browse files Browse the repository at this point in the history
  • Loading branch information
cr4yfish committed Jul 8, 2023
1 parent d32938e commit b00e5f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import { useSession } from "@/hooks/auth";
import { useNavbar } from "@/hooks/navbar";
import styles from "../styles/Navbar.module.css";
import Username from "./User/Username";
import { handleLogout } from "@/utils/authFunctions";
import { useRouter } from "next/navigation";

export default function Navbar() {
const { session } = useSession();
const { session, setSession } = useSession();
const { navbar, setNavbar } = useNavbar();
const [isSearching, setIsSearching] = useState(false);
const [filterClicked, setFilterClicked] = useState(false);
const [userMenu, setUserMenu] = useState(false);

const router = useRouter();

const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
alert("This isn't doing anything yet.")
Expand Down Expand Up @@ -90,7 +94,7 @@ export default function Navbar() {

{ navbar?.showback &&
<div className={`${styles.backButton}`}>
<button className="flex items-center gap-2" onClick={() => window.history.back()}><span className="material-icons">arrow_back</span>Back</button>
<button className="flex items-center gap-2" onClick={() => router.back()}><span className="material-icons">arrow_back</span>Back</button>
</div>
}

Expand Down Expand Up @@ -166,7 +170,7 @@ export default function Navbar() {
<div className={`${styles.userMenuInteractionsBottom}`}>
<button onClick={() => handleUserMenuClose()}><span className="material-icons-outlined">close</span>Close</button>
<button><span className="material-icons-outlined">settings</span>Settings</button>
<button><span className="material-icons-outlined">logout</span>Log out</button>
<button onClick={() => { handleUserMenuClose(); handleLogout({ session: session, setSession: setSession, router: router }) }} ><span className="material-icons-outlined">logout</span>Log out</button>
</div>
</div>

Expand Down

0 comments on commit b00e5f1

Please sign in to comment.