aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-10-03 18:55:14 +0200
committerWilliam Hergès <william@herges.fr>2025-10-03 18:55:14 +0200
commitf4a7265be6b4b9c4eedad561a8ed26cd8b7003b0 (patch)
tree4320311f70902bb87f47e2272308fff4ae9e5a98 /frontend
parent3ba8390e4bc08f5bf6f674c308cecb72466b1140 (diff)
feat(backend): handle 404
Diffstat (limited to 'frontend')
-rw-r--r--frontend/index.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/frontend/index.ts b/frontend/index.ts
index 316caaf..c337e43 100644
--- a/frontend/index.ts
+++ b/frontend/index.ts
@@ -18,9 +18,15 @@ function setupAnchors() {
// updating history and window title
document.addEventListener("htmx:afterSettle", e => {
const title = e.detail.xhr.getResponseHeader("Updated-Title")
- if (title?.length != 0) document.title = title
+ if (title?.length !== 0) document.title = title
window.history.pushState({}, "", e.detail.pathInfo.finalRequestPath)
setupAnchors()
})
+document.body.addEventListener('htmx:beforeSwap', function(e) {
+ if(e.detail.xhr.status !== 404) return
+ e.detail.shouldSwap = true;
+ e.detail.isError = false;
+})
+
setupAnchors()