diff --git a/priv/static/index.html b/priv/static/index.html index 063342f..638ad82 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -60,6 +60,9 @@ +
+ Reset +
diff --git a/priv/static/js/jenot.js b/priv/static/js/jenot.js index e917477..67b3f3a 100644 --- a/priv/static/js/jenot.js +++ b/priv/static/js/jenot.js @@ -9,6 +9,18 @@ import { } from "./notifications.js"; import "./components.js"; +async function resetApp() { + await window.navigator.serviceWorker + .getRegistration() + .then((r) => r.unregister()); + await caches + .keys() + .then((keys) => Promise.all(keys.map((k) => caches.delete(k)))); + window.location.reload(); +} + +document.querySelector("#reset-app").addEventListener("click", resetApp); + const URL_PARAMS = new URLSearchParams(window.location.search); // Cookie presence determines login state