store persistent data in sessionStorage instead of localStorage

closes #17
This commit is contained in:
liquidex 2023-08-29 14:28:18 +02:00
parent e7e848daeb
commit ffd762f08f

View file

@ -3,11 +3,11 @@
import { navigationMap } from "/navmap.js"; import { navigationMap } from "/navmap.js";
const branchStateKey = "treehouse.openBranches"; const branchStateKey = "treehouse.openBranches";
let branchState = JSON.parse(localStorage.getItem(branchStateKey)) || {}; let branchState = JSON.parse(sessionStorage.getItem(branchStateKey)) || {};
function saveBranchIsOpen(branchID, state) { function saveBranchIsOpen(branchID, state) {
branchState[branchID] = state; branchState[branchID] = state;
localStorage.setItem(branchStateKey, JSON.stringify(branchState)); sessionStorage.setItem(branchStateKey, JSON.stringify(branchState));
} }
function branchIsOpen(branchID) { function branchIsOpen(branchID) {