aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/style/transition.js
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-05-16 19:35:19 +0200
committermetamuffin <metamuffin@disroot.org>2023-05-16 19:35:19 +0200
commit3eda83a00f1c3e065a3e36675b40cc240cdb6ed6 (patch)
tree1c2658d9a1fa4b8589f5c209e256693226c3a8a7 /server/src/routes/ui/style/transition.js
parent7598407db13e4067d25526f206f2ca726eb17e57 (diff)
downloadjellything-3eda83a00f1c3e065a3e36675b40cc240cdb6ed6.tar
jellything-3eda83a00f1c3e065a3e36675b40cc240cdb6ed6.tar.bz2
jellything-3eda83a00f1c3e065a3e36675b40cc240cdb6ed6.tar.zst
fix transition fetch error
Diffstat (limited to 'server/src/routes/ui/style/transition.js')
-rw-r--r--server/src/routes/ui/style/transition.js14
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()