Skip to content

Commit

Permalink
added try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavanakarwade committed Dec 4, 2024
1 parent 7e56b0c commit 20aa8a5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>{
Expand Down

0 comments on commit 20aa8a5

Please sign in to comment.