Loading indicator on a custom action with alpineClickHandler

My action process is ran with alpinejs component rather than a submit action
public function securityKeyAction(): Action
{
$name = \App\Services\TwoFactorService::SECURITY_KEY_METHOD;
return Action::make("securitykey")
->label("Register new key")
->icon('heroicon-c-plus-circle')
->color('success')
->hidden(function () use ($name) {
return $this->config['methods'][$name]['enabled'] ? false : true;
})
->extraAttributes(['x-data' => 'registerPasskey', 'x-show' => 'browserSupportsWebAuthn()'])
->alpineClickHandler('register("' . Str::random(10) . '")');
}
public function securityKeyAction(): Action
{
$name = \App\Services\TwoFactorService::SECURITY_KEY_METHOD;
return Action::make("securitykey")
->label("Register new key")
->icon('heroicon-c-plus-circle')
->color('success')
->hidden(function () use ($name) {
return $this->config['methods'][$name]['enabled'] ? false : true;
})
->extraAttributes(['x-data' => 'registerPasskey', 'x-show' => 'browserSupportsWebAuthn()'])
->alpineClickHandler('register("' . Str::random(10) . '")');
}
But I want to display a loading indicator while it goes through the flow, but cant seem to find a way to show the indicator. The blade is rendering just with ```php {{$this->securityKeyAction}} rather than blade components for the button etc
4 Replies
Mokatchi
Mokatchi2mo ago
Hello Jamie, can you please tell me how did you do to display your code well formated like this??
Mokatchi
Mokatchi2mo ago
thank you so much
Jamie Cee
Jamie CeeOP2mo ago
bump
Want results from more Discord servers?
Add your server