The Problem:
allowing all responses status to swap:
<meta name="htmx-config" content='{"responseHandling": [{"code":"...", "swap": true}]}'>
Listen to hx-on:after-request on an element:
<form hx-on::after-request='if(event.detail.successful) { doSome() }>
event.detail.successful is always true, even for error (not 2xx status) responses
detail.successful - true if the response has a 20x status code or is marked detail.isError = false in the htmx:beforeSwap event, else false
Doesn't mention that allowing all responses status to swap will also mark the response as successful?
The Problem:
allowing all responses status to swap:
<meta name="htmx-config" content='{"responseHandling": [{"code":"...", "swap": true}]}'>Listen to hx-on:after-request on an element:
<form hx-on::after-request='if(event.detail.successful) { doSome() }>event.detail.successful is always true, even for error (not 2xx status) responses
From the ::afterRequest Doc:
Doesn't mention that allowing all responses status to swap will also mark the response as successful?