diff --git a/app/javascript/controllers/turbo_input_controller.tsx b/app/javascript/controllers/turbo_input_controller.tsx index e2ad35db3..2c08333ee 100644 --- a/app/javascript/controllers/turbo_input_controller.tsx +++ b/app/javascript/controllers/turbo_input_controller.tsx @@ -5,10 +5,12 @@ import { ApplicationController } from './application_controller'; export class TurboInputController extends ApplicationController { static values = { url: String, + method: { type: String, default: 'get' }, loadOnConnect: { type: Boolean, default: false } }; declare readonly urlValue: string; + declare readonly methodValue: string; declare readonly loadOnConnectValue: boolean; connect(): void { @@ -22,6 +24,8 @@ export class TurboInputController extends ApplicationController { const target = this.element as HTMLInputElement; const url = new URL(this.urlValue, document.baseURI); url.searchParams.append(target.name, target.value); - httpRequest(url.toString()).turbo(); + httpRequest(url.toString(), { + method: this.methodValue + }).turbo(); } }