feat: "spa", but more like single entry-point
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// Per-page data Django injects via `{{ bootstrap|json_script:"bootstrap-data" }}`
|
||||
// in templates/app.html. Read once at boot, before the router/app are created.
|
||||
export const bootstrap: Record<string, unknown> = (() => {
|
||||
const el = document.getElementById("bootstrap-data");
|
||||
if (!el?.textContent) return {};
|
||||
try {
|
||||
return JSON.parse(el.textContent);
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user