From 10038f61808667bfa3ae4fa22788881b81866ceb Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 5 Dec 2024 17:18:56 +0530 Subject: [PATCH] added check in decrypt function --- src/api/Auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/Auth.ts b/src/api/Auth.ts index 2c967073..804f359c 100644 --- a/src/api/Auth.ts +++ b/src/api/Auth.ts @@ -299,10 +299,10 @@ export const getFromLocalStorage = async (key: string) => { return null; } - const decryptedValue = decryptData(encryptedValue); + const decryptedValue = encryptedValue ? decryptData(encryptedValue) : ''; console.log(`Decrypted value for [${key}]:`, decryptedValue); - return decryptedValue ? JSON.parse(decryptedValue) : null; + return decryptedValue; } catch (error) { console.error(`Error getting localStorage [${key}]:`, error); return null;