Merge branch 'issue-171-htmx-errors' into 'main'

handle 4xx and 5xx error codes with htmx

See merge request yaal/canaille!161
This commit is contained in:
Éloi Rivard 2023-12-01 10:54:23 +00:00
commit a2ab6a4ed1
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;
}
});