From 7615fec14a61dabb50cf44e0c2d43db1f9ce9982 Mon Sep 17 00:00:00 2001 From: stevejpurves Date: Wed, 22 Nov 2023 14:47:39 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=83added=20default=20args=20to=20clear?= =?UTF-8?q?=20session=20storage=20helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/twenty-pigs-relax.md | 5 +++++ packages/core/src/sessions.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/twenty-pigs-relax.md diff --git a/.changeset/twenty-pigs-relax.md b/.changeset/twenty-pigs-relax.md new file mode 100644 index 00000000..e3599f1d --- /dev/null +++ b/.changeset/twenty-pigs-relax.md @@ -0,0 +1,5 @@ +--- +'thebe-core': patch +--- + +Added default arguments to clear sesion storage utility functions diff --git a/packages/core/src/sessions.ts b/packages/core/src/sessions.ts index 1a80ed56..f97c50db 100644 --- a/packages/core/src/sessions.ts +++ b/packages/core/src/sessions.ts @@ -94,7 +94,7 @@ export async function getExistingServer( * * @param storagePrefix */ -export function clearAllSavedSessions(storagePrefix: string) { +export function clearAllSavedSessions(storagePrefix: string = 'thebe-binder') { const keysToRemove: string[] = []; for (let i = 0; i < window.localStorage.length; i++) { const key = window.localStorage.key(i); @@ -117,7 +117,7 @@ export function clearAllSavedSessions(storagePrefix: string) { * @param storagePrefix * @param url */ -export function clearSavedSession(storagePrefix: string, url: string) { +export function clearSavedSession(storagePrefix: string = 'thebe-binder', url: string = '') { console.debug(`thebe:clearSavedSession - removing ${makeStorageKey(storagePrefix, url)}`); window.localStorage.removeItem(makeStorageKey(storagePrefix, url)); }