From 412f15814e6bffabb9263cf44379c3481abf3906 Mon Sep 17 00:00:00 2001 From: Hariom Date: Fri, 10 Nov 2023 12:48:54 +0530 Subject: [PATCH] Add removeItem to webstorage --- packages/lib/webstorage.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/lib/webstorage.ts b/packages/lib/webstorage.ts index a262c190b0..c703bfda05 100644 --- a/packages/lib/webstorage.ts +++ b/packages/lib/webstorage.ts @@ -1,5 +1,5 @@ /** - * Provides a wrapper around localStorage to avoid errors in case of restricted storage access. + * Provides a wrapper around localStorage(and sessionStorage(TODO when needed)) to avoid errors in case of restricted storage access. * * TODO: In case of an embed if localStorage is not available(third party), use localStorage of parent(first party) that contains the iframe. */ @@ -25,4 +25,12 @@ export const localStorage = { return; } }, + removeItem: (key: string) => { + try { + // eslint-disable-next-line @calcom/eslint/avoid-web-storage + window.localStorage.removeItem(key); + } catch (e) { + return; + } + }, };