diff options
Diffstat (limited to 'server/src/routes/ui/style')
-rw-r--r-- | server/src/routes/ui/style/transition.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/src/routes/ui/style/transition.js b/server/src/routes/ui/style/transition.js index 6f558fb..6a4477e 100644 --- a/server/src/routes/ui/style/transition.js +++ b/server/src/routes/ui/style/transition.js @@ -32,11 +32,17 @@ async function transition_to(href) { function prepare_load(href) { const r_promise = fetch(href) return async () => { - const r = await r_promise - const rt = await r.text() - const [head, body] = rt.split("<head>")[1].split("</body>")[0].split("</head><body>") + let rt = "" + try { + const r = await r_promise + rt = await r.text() + } catch (e) { + console.error(e) + return + } + const [head, body] = rt.split("<head>")[1].split("</head>") document.head.innerHTML = head - document.body.innerHTML = body + document.body.outerHTML = body fade(true) window.history.pushState({}, "", href) patch_page() |