mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
feat(redirect): add redirectRoute helper for SPA navigation support
This commit is contained in:
@@ -111,7 +111,7 @@ class Danger extends Component
|
|||||||
$this->docker_cleanup
|
$this->docker_cleanup
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect()->route('project.resource.index', [
|
return redirectRoute($this, 'project.resource.index', [
|
||||||
'project_uuid' => $this->projectUuid,
|
'project_uuid' => $this->projectUuid,
|
||||||
'environment_uuid' => $this->environmentUuid,
|
'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
|
function getHelperVersion(): string
|
||||||
{
|
{
|
||||||
$settings = instanceSettings();
|
$settings = instanceSettings();
|
||||||
|
|||||||
Reference in New Issue
Block a user