Add removeItem to webstorage

This commit is contained in:
Hariom 2023-11-10 12:48:54 +05:30 committed by Peer Richelsen
parent a57085cf64
commit 412f15814e

View File

@ -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;
}
},
};