From 20aa8a58bf86ac14505b9cd15ca2d89498697f4e Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 4 Dec 2024 19:41:12 +0530 Subject: [PATCH] added try catch --- src/api/Auth.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/Auth.ts b/src/api/Auth.ts index 0bfc64d3..93e5dfb6 100644 --- a/src/api/Auth.ts +++ b/src/api/Auth.ts @@ -245,15 +245,15 @@ export const encryptData = (value: any): string => { export const decryptData = (value: any): string => { const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}` - // try { + try { let bytes = CryptoJS.AES.decrypt(value, CRYPTO_PRIVATE_KEY); console.log(bytes , 'bytes........................') return bytes.toString(CryptoJS.enc.Utf8); - // } catch (error) { + } catch (error) { // Handle decryption error or invalid input - // console.error('Decryption error:kkkkkkk', error); - // return ''; - // } + console.error('Decryption error:kkkkkkk', error); + return ''; + } } export const setToLocalStorage = async (key: string, value: any) =>{