Skip to content

Commit

Permalink
added delay
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavanakarwade committed Dec 9, 2024
1 parent 532c1ac commit 7bf800f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ export const decryptData = (value: string): string => {


export const setToLocalStorage = async (key: string, value: any) =>{
await delay(2000); // 2-second delay before setting data

// If passed value is object then checked empty object
if (typeof value === 'object' && Boolean(Object.keys(value).length <= 0)) {
return;
Expand All @@ -283,7 +285,11 @@ export const setToLocalStorage = async (key: string, value: any) =>{
return true
}

const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

export const getFromLocalStorage = async (key: string) => {
await delay(2000); // 2-second delay

try {
const encryptedValue = localStorage.getItem(key);

Expand Down

0 comments on commit 7bf800f

Please sign in to comment.