mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 15:37:53 +00:00
add error handling for preview
This commit is contained in:
parent
dab9fc705d
commit
e80814daa3
1 changed files with 13 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Livewire\Attributes\On;
|
use Livewire\Attributes\On;
|
||||||
|
use Livewire\Attributes\Computed;
|
||||||
|
|
||||||
new class extends Component {
|
new class extends Component {
|
||||||
public Plugin $plugin;
|
public Plugin $plugin;
|
||||||
|
|
@ -295,8 +296,6 @@ new class extends Component {
|
||||||
return $this->configuration[$key] ?? $default;
|
return $this->configuration[$key] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function renderExample(string $example)
|
public function renderExample(string $example)
|
||||||
{
|
{
|
||||||
switch ($example) {
|
switch ($example) {
|
||||||
|
|
@ -431,6 +430,17 @@ HTML;
|
||||||
$this->plugin = $this->plugin->fresh();
|
$this->plugin = $this->plugin->fresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Laravel Livewire computed property: access with $this->parsed_urls
|
||||||
|
#[Computed]
|
||||||
|
private function parsedUrls()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $this->plugin->resolveLiquidVariables($this->polling_url);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return 'PARSE_ERROR: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -779,7 +789,7 @@ HTML;
|
||||||
placeholder="Nothing to show..."
|
placeholder="Nothing to show..."
|
||||||
rows="5"
|
rows="5"
|
||||||
>
|
>
|
||||||
{{ $this->plugin->resolveLiquidVariables($this->polling_url) }}
|
{{ $this->parsed_urls }}
|
||||||
</flux:textarea>
|
</flux:textarea>
|
||||||
</flux:field>
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue