Skip to content

Commit

Permalink
Made a function for setting standard values, and calls it in OnInitia…
Browse files Browse the repository at this point in the history
…lize
  • Loading branch information
thom776g committed Dec 7, 2023
1 parent 185e670 commit 8cae0d1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions CentralHub.WebUI/Pages/Rooms.razor
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ else
{
await JSRuntime.InvokeVoidAsync("alert", "Room is null");
}

}

async Task DeleteRoomModal(TreeItem item)
Expand Down Expand Up @@ -520,6 +519,7 @@ else
));
}
_treeRoomItems = treeItems;
AssignStandardValues();
}
private async Task<int> GetTrackerCountAsync(Room room)
{
Expand Down Expand Up @@ -562,6 +562,18 @@ void ToggleNode(TreeItem item)
}

async Task HideModal(String modalId)
{
await JSRuntime.InvokeVoidAsync("hideModal", modalId);
AssignStandardValues();
StateHasChanged();
}

async Task ShowModal(String modalId)
{
await JSRuntime.InvokeVoidAsync("showModal", modalId);
}

void AssignStandardValues()
{
_selectedRoomItem = null;
_selectedTracker = null;
Expand All @@ -572,13 +584,6 @@ async Task HideModal(String modalId)
_trackerName = "Your tracker name";
_trackerDescription = "Your tracker description";
_selectedTrackerMacAdress = "-1";

await JSRuntime.InvokeVoidAsync("hideModal", modalId);
StateHasChanged();
}

async Task ShowModal(String modalId)
{
await JSRuntime.InvokeVoidAsync("showModal", modalId);
}
}

0 comments on commit 8cae0d1

Please sign in to comment.