mirror of
https://github.com/we-promise/sure.git
synced 2026-04-22 21:44:11 +00:00
22 lines
547 B
JavaScript
22 lines
547 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["buttonText", "spinner"]
|
|
|
|
submit(event) {
|
|
// Don't prevent default - let the form submit
|
|
|
|
// Show spinner and update text
|
|
if (this.hasButtonTextTarget) {
|
|
this.buttonTextTarget.textContent = "Sending code..."
|
|
}
|
|
|
|
if (this.hasSpinnerTarget) {
|
|
this.spinnerTarget.classList.remove("hidden")
|
|
}
|
|
|
|
// Disable the button to prevent double-clicks
|
|
event.currentTarget.disabled = true
|
|
}
|
|
}
|