diff options
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/index.ts | 8 |
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() |
