From 7bf800f63208ed620472cfc4ca2a0a9febaf4a3f Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Mon, 9 Dec 2024 10:42:20 +0530 Subject: [PATCH] added delay --- src/api/Auth.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/Auth.ts b/src/api/Auth.ts index 1b984dd7..8ad6b338 100644 --- a/src/api/Auth.ts +++ b/src/api/Auth.ts @@ -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; @@ -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);