implement account id localstorage saving

This commit is contained in:
insects 2025-02-07 15:18:06 +01:00
parent f9bc80cc80
commit 75092f3e0e
3 changed files with 17 additions and 1 deletions

6
static/scripts/load.js Normal file
View file

@ -0,0 +1,6 @@
// Loads an account ID and redirects
const ls = window.localStorage;
const maybeId = ls.getItem("beacon:account-id");
if (maybeId) {
window.location.pathname = `/${maybeId}`;
}

6
static/scripts/save.js Normal file
View file

@ -0,0 +1,6 @@
// Saves the account ID in local storage
const id = document.getElementById("account-id");
const ls = window.localStorage;
if (id) {
ls.setItem("beacon:account-id", id.innerHTML);
}