From 8769bb55dc641d716110f3ebf7192dd5aafa3fe9 Mon Sep 17 00:00:00 2001 From: Bahugunajii Date: Fri, 22 Dec 2023 14:29:14 +0530 Subject: [PATCH 1/3] Added logout button --- assets/profile.png | Bin 0 -> 524 bytes components/TopBar.tsx | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 assets/profile.png diff --git a/assets/profile.png b/assets/profile.png new file mode 100644 index 0000000000000000000000000000000000000000..1613774e3fb1af7c72b1df70ab605fbe186418bb GIT binary patch literal 524 zcmV+n0`vWeP)P000>X1^@s6#OZ}&00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yP?wxpDhv&czKTDhPt*3E&6~plxFfkDK!tNGNkQ=dbmVh$efvS8CJo>|oE=|jl09Cyk&w>n-G!(@G)SohE z*qbw-_z8|1V#guJX{oV;B6rX!7VxgqJk(m$JV^sU&K>jqu2d5zTe)7A#_-9p#oyig zjE;x}x}G_%H`i>e=OF#(QGnqc { const { userName } = useAuth(); + const [isDropdownOpen, setIsDropdownOpen] = useState(false); const routeNames: { [key: string]: string } = { '/reports': 'Report', '/library': 'Library', @@ -15,11 +20,33 @@ const TopBar = () => { const pathname = usePathname(); const routeName = routeNames[pathname] ||

Welcome,
Shagun Panday

; + const toggleDropdown = () => { + setIsDropdownOpen(!isDropdownOpen); + }; + + const handleLogout = () => { + deleteCookie("access_token"); + deleteCookie("refresh_token"); + }; + return (
-
+
{routeName} +
+ Profile + {isDropdownOpen && ( +
+ +
+ )} +
From 16620176f5901ae1e4ef9328d077f96416ba0c34 Mon Sep 17 00:00:00 2001 From: Bahugunajii Date: Fri, 22 Dec 2023 15:17:53 +0530 Subject: [PATCH 2/3] fixed alignment --- components/TopBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/TopBar.tsx b/components/TopBar.tsx index a72c5b5..05c75ef 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -42,7 +42,7 @@ const TopBar = () => { onClick={toggleDropdown} /> {isDropdownOpen && ( -
+
)} From cfb8735256f0322d238cab9f83b217dab0f267d6 Mon Sep 17 00:00:00 2001 From: Bahugunajii Date: Fri, 22 Dec 2023 15:41:10 +0530 Subject: [PATCH 3/3] made page to reload once token gets deleted --- components/TopBar.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/TopBar.tsx b/components/TopBar.tsx index 05c75ef..a20eaa9 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -27,6 +27,7 @@ const TopBar = () => { const handleLogout = () => { deleteCookie("access_token"); deleteCookie("refresh_token"); + window.location.reload(); }; return (