From 53b5b37a268da86840730403959e7235079dec55 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Mon, 21 Nov 2022 12:00:41 +0000 Subject: [PATCH] added `deleteInternalStorage` util --- .../app/src/utils/deleteInternalStorage/index.js | 15 +++++++++++++++ packages/app/src/utils/index.js | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 packages/app/src/utils/deleteInternalStorage/index.js diff --git a/packages/app/src/utils/deleteInternalStorage/index.js b/packages/app/src/utils/deleteInternalStorage/index.js new file mode 100644 index 00000000..51f4c4f6 --- /dev/null +++ b/packages/app/src/utils/deleteInternalStorage/index.js @@ -0,0 +1,15 @@ +import cookies from "js-cookie" + +export default () => { + window.localStorage.clear() + window.sessionStorage.clear() + + // delete all cookies + const allCookies = cookies.get() + + for (const cookieName in allCookies) { + cookies.remove(cookieName) + } + + location.reload() +} \ No newline at end of file diff --git a/packages/app/src/utils/index.js b/packages/app/src/utils/index.js index 9516229b..1d545630 100755 --- a/packages/app/src/utils/index.js +++ b/packages/app/src/utils/index.js @@ -3,4 +3,5 @@ export { default as findChildById } from "./findChildById" export { default as cursorPosition } from "./cursorPosition" export { default as getBase64 } from "./getBase64" export { default as Haptics } from "./haptics" -export { default as processString } from "./processString" \ No newline at end of file +export { default as processString } from "./processString" +export { default as deleteInternalStorage } from "./deleteInternalStorage" \ No newline at end of file