1
0
watterblock/index.js
Adrian Wannenmacher de0fc8c917
enable history navigation
The previous implementation only looked at the URL (and state) during
initialization. This allowed users to open a specific session via URL
(e.g. when reloading the page).

History navigation, however, was completely ignored. I.e. if the user
pressed the back button the URL would change, but the content would
remain the same.

This has now been corrected.
2026-03-01 02:28:47 +01:00

18 lines
438 B
JavaScript

"use strict";
import Layout from "/ui/layout.js";
import BaseView from "/ui/base_view.js";
m.route.prefix = "";
m.route(document.body, "/", {
"/": {
render: function(vnode) {
let newSession = vnode.attrs.newSession ?? false;
let session = newSession ? null : parseInt(vnode.attrs.session);
session = isNaN(session) ? null : session;
return m(Layout, m(BaseView, { newSession, session }));
},
},
});