feat(redirect): add redirectRoute helper for SPA navigation support
This commit is contained in:
parent
a33dbb8a90
commit
5d98847e49
2 changed files with 18 additions and 1 deletions
|
|
@ -111,7 +111,7 @@ public function delete($password)
|
|||
$this->docker_cleanup
|
||||
);
|
||||
|
||||
return redirect()->route('project.resource.index', [
|
||||
return redirectRoute($this, 'project.resource.index', [
|
||||
'project_uuid' => $this->projectUuid,
|
||||
'environment_uuid' => $this->environmentUuid,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -2934,6 +2934,23 @@ function wireNavigate(): string
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to a named route with SPA navigation support.
|
||||
* Automatically uses wire:navigate when is_wire_navigate_enabled is true.
|
||||
*/
|
||||
function redirectRoute(Livewire\Component $component, string $name, array $parameters = []): mixed
|
||||
{
|
||||
$navigate = true;
|
||||
|
||||
try {
|
||||
$navigate = instanceSettings()->is_wire_navigate_enabled ?? true;
|
||||
} catch (\Exception $e) {
|
||||
$navigate = true;
|
||||
}
|
||||
|
||||
return $component->redirectRoute($name, $parameters, navigate: $navigate);
|
||||
}
|
||||
|
||||
function getHelperVersion(): string
|
||||
{
|
||||
$settings = instanceSettings();
|
||||
|
|
|
|||
Loading…
Reference in a new issue