Added node server sync and delete sync. Cleaned up codebase and extracted calls to apis to services

This commit is contained in:
2025-03-02 19:24:24 +01:00
parent ef7f866ded
commit 30390dab71
25 changed files with 751 additions and 282 deletions

View File

@@ -1,8 +1,8 @@
@using MoonCore.Helpers
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Enums
@using MoonlightServers.Shared.Http.Responses.Users.Servers
@inject HttpApiClient ApiClient
@inject ServerService ServerService
@inject ILogger<ServerCard> Logger
@{
@@ -158,9 +158,7 @@
try
{
Status = await ApiClient.GetJson<ServerStatusResponse>(
$"api/client/servers/{Server.Id}/status"
);
Status = await ServerService.GetStatus(Server.Id);
}
catch (Exception e)
{

View File

@@ -1,11 +1,12 @@
@using MoonCore.Blazor.Tailwind.Alerts
@using MoonCore.Helpers
@using MoonCore.Blazor.Tailwind.Components
@using MoonlightServers.Frontend.Services
@using MoonlightServers.Shared.Enums
@inherits BaseServerTab
@inject HttpApiClient HttpApiClient
@inject ServerService ServerService
@inject AlertService AlertService
<div class="grid grid-cols-1 md:col-span-2 lg:grid-cols-3">
@@ -34,7 +35,7 @@
await AlertService.ConfirmDanger(
"Server installation",
"Do you really want to reinstall the server? This can potentially lead to loss of data",
() => HttpApiClient.Post($"api/client/servers/{Server.Id}/install")
() => ServerService.Install(Server.Id)
);
}
}