BrainMinder/assets/static/js/htmx/ext/rails-method.js

11 lines
334 B
JavaScript
Raw Normal View History

2024-08-22 10:13:16 +02:00
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;
}
}
}
});