From 3662d56e901b11a178069f84b5c175eb33bdad64 Mon Sep 17 00:00:00 2001 From: ankitrewar11 Date: Mon, 21 Sep 2026 07:31:45 +0530 Subject: [PATCH] [fix]: add token validation before fetching user data Signed-off-by: ankitrewar11 --- src/sitecomponents/Navigation/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sitecomponents/Navigation/index.js b/src/sitecomponents/Navigation/index.js index 0040254..7d84028 100644 --- a/src/sitecomponents/Navigation/index.js +++ b/src/sitecomponents/Navigation/index.js @@ -38,6 +38,11 @@ function Navigation({ theme, toggleTheme, showSignUpButton, logo }) { const fetchData = async () => { try { const token = getCookieValue("provider_token"); + + if (!token) { + return; + } + const response = await axios.get(CLOUD_USER_API, { headers: { Authorization: `Bearer ${token}`, @@ -49,7 +54,7 @@ function Navigation({ theme, toggleTheme, showSignUpButton, logo }) { } const data = response.data; - // setUserData(data); + setUserData(data); } catch (error) { console.error("There was a problem with your fetch operation:", error); }