Skip to content

Commit

Permalink
fix: clear localStorage and sessionStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
preschian committed Mar 24, 2023
1 parent 6723c4d commit 588c0ef
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions utils/cachingStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ export const flushIndexedDb = () => {

export const clearSession = () => {
try {
window.sessionStorage.clear()
window.localStorage.clear()
flushIndexedDb()
setTimeout(() => {
window.sessionStorage.clear()
window.localStorage.clear()
flushIndexedDb()
}, 100)
} catch (error) {
console.error(error)
} finally {
window.location.reload()
setTimeout(() => {
window.location.reload()
}, 200)
}
}

0 comments on commit 588c0ef

Please sign in to comment.