From f4a7265be6b4b9c4eedad561a8ed26cd8b7003b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Fri, 3 Oct 2025 18:55:14 +0200 Subject: feat(backend): handle 404 --- frontend/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'frontend') 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() -- cgit v1.2.3