From 104341ddc4add57f83c58cb3fabb23b6fbfdd3e4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 2 Nov 2025 00:00:35 +0900 Subject: wip --- frontend/src/components/Navigation.tsx | 26 ++++++++++++++++++++++-- frontend/src/components/ProtectedRoute.tsx | 32 ++++++++++++++++++++++++++++++ frontend/src/components/index.ts | 1 + 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 frontend/src/components/ProtectedRoute.tsx (limited to 'frontend/src/components') diff --git a/frontend/src/components/Navigation.tsx b/frontend/src/components/Navigation.tsx index 08a523f..d6e20c9 100644 --- a/frontend/src/components/Navigation.tsx +++ b/frontend/src/components/Navigation.tsx @@ -2,11 +2,22 @@ import { faBookOpen, faCircleCheck, faGear, + faRightFromBracket, } from "@fortawesome/free-solid-svg-icons"; -import { Link } from "wouter"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { Link, useLocation } from "wouter"; +import { useAuth } from "../contexts/AuthContext"; import { MenuItem } from "./MenuItem"; export function Navigation() { + const { logout, user } = useAuth(); + const [, setLocation] = useLocation(); + + const handleLogout = async () => { + await logout(); + setLocation("/login"); + }; + return (