From 6c8eb7d2f3e8bd3c01c9f8d854312ade2124b4d4 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Tue, 10 Jun 2025 11:51:39 +0530 Subject: [PATCH] refactor: Update getUserData function to return empty user data object instead of throwing an error when localStorage is missing values --- app/src/components/Dashboard/functions/getUserData.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/components/Dashboard/functions/getUserData.ts b/app/src/components/Dashboard/functions/getUserData.ts index 132dcc2..e0e97ec 100644 --- a/app/src/components/Dashboard/functions/getUserData.ts +++ b/app/src/components/Dashboard/functions/getUserData.ts @@ -11,7 +11,12 @@ export const getUserData = (): UserData => { const userName = localStorage.getItem("userName"); if (!email || !userId) { - throw new Error("User data not found in localStorage"); + return { + email: '', + userId: '', + userName: '', + organization: '', + }; } const [_, emailDomain] = email.split("@");