BrainMinder/assets/static/js/htmx/ext/rails-method.js
2024-08-22 10:13:16 +02:00

11 lines
334 B
JavaScript

htmx.defineExtension('rails-method', {
onEvent: function (name, evt) {
if (name === "configRequest.htmx") {
var methodOverride = evt.detail.headers['X-HTTP-Method-Override'];
if (methodOverride) {
evt.detail.parameters['_method'] = methodOverride;
}
}
}
});