Skip to content

Commit

Permalink
fix: Handle missing router in DashboardComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
bangyadiii committed Jun 3, 2024
1 parent 8f9cae8 commit 892dd00
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Livewire/Dashboard/DashboardComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function initializeRouter()

public function fetchRouterResource()
{
if ($this->hasError) {
if ($this->hasError || !$this->router) {
return;
}

Expand Down Expand Up @@ -129,7 +129,7 @@ public function fetchSecrets()

public function fetchTrafficData()
{
if ($this->hasError) {
if ($this->hasError || !$this->router) {
return;
}

Expand Down Expand Up @@ -177,6 +177,9 @@ protected function updateTrafficData($data)
public function updatedSelectedRouterId()
{
$this->router = Router::find($this->selectedRouterId);
if (!$this->router) {
return;
}
Cookie::queue('routerId', $this->router?->id, 60 * 24 * 30); // 30 days
$this->hasError = false;
$this->resetResourceData();
Expand Down

0 comments on commit 892dd00

Please sign in to comment.