fix: handle 4xx and 5xx error codes with htmx

This commit is contained in:
Éloi Rivard 2023-12-01 11:49:09 +01:00
parent 8e960d956b
commit e09a3071d4
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184
2 changed files with 12 additions and 0 deletions

View file

@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
Fixed
*****
- Handle 4xx and 5xx error codes with htmx. :issue:`171` :pr:`181`
[0.0.36] - 2023-12-01
=====================

View file

@ -12,3 +12,10 @@ document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('htmx:load', onDomChanges);
document.body.addEventListener('htmx:beforeOnLoad', function (evt) {
if (evt.detail.xhr.status >= 400) {
evt.detail.shouldSwap = true;
evt.detail.isError = false;
}
});