diff --git a/LANCommander/Pages/Games/Edit.razor b/LANCommander/Pages/Games/Edit.razor index cbe86d9..f9914ae 100644 --- a/LANCommander/Pages/Games/Edit.razor +++ b/LANCommander/Pages/Games/Edit.razor @@ -239,7 +239,7 @@ else { Game = await GameService.Add(Game); - await MessageService.Success("Game added!"); + NavigationManager.LocationChanged += NotifyGameAdded; NavigationManager.NavigateTo($"/Games/{Game.Id}"); } @@ -250,6 +250,13 @@ else } } + private void NotifyGameAdded(object? sender, LocationChangedEventArgs e) + { + NavigationManager.LocationChanged -= NotifyGameAdded; + + MessageService.Success("Game added!"); + } + private async Task BrowseForIcon() { var modalOptions = new ModalOptions() diff --git a/LANCommander/Pages/Servers/Edit.razor b/LANCommander/Pages/Servers/Edit.razor index b5f7e8e..e24d905 100644 --- a/LANCommander/Pages/Servers/Edit.razor +++ b/LANCommander/Pages/Servers/Edit.razor @@ -196,7 +196,7 @@ { Server = await ServerService.Add(Server); - await MessageService.Success("Server added!"); + NavigationManager.LocationChanged += NotifyServerAdded; NavigationManager.NavigateTo($"/Servers/{Server.Id}"); } @@ -207,6 +207,13 @@ } } + private void NotifyServerAdded(object? sender, LocationChangedEventArgs e) + { + NavigationManager.LocationChanged -= NotifyServerAdded; + + MessageService.Success("Server added!"); + } + private string GetIcon(Game game) { return $"/api/Games/{game?.Id}/Icon.png";