Skip to content

Commit

Permalink
Update Edit.razor
Browse files Browse the repository at this point in the history
  • Loading branch information
neozhu committed Dec 15, 2024
1 parent 9e4008b commit 4eb7c6b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/CleanAspire.ClientApp/Pages/Products/Edit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<PageTitle>@Title</PageTitle>

<Breadcrumbs OnSaveButtonClick="Save" Saving="@(_saving || !_isOnline)" BreadcrumbItems="_breadcrumbItems"></Breadcrumbs>
<Breadcrumbs OnSaveButtonClick="Save" Saving="@_saving" BreadcrumbItems="_breadcrumbItems"></Breadcrumbs>
<MudPaper Class="pa-5">
@if (model is not null)
{
Expand Down Expand Up @@ -56,7 +56,7 @@
</MudTextField>
</MudItem>
<MudItem xs="12" md="12" Class="d-flex justify-end">
<MudButton Disabled="@(_saving || !_isOnline)" Color="Color.Primary" OnClick="Save">@L["Save"]</MudButton>
<MudButton Disabled="@_saving" Color="Color.Primary" OnClick="Save">@L["Save"]</MudButton>
</MudItem>
</MudGrid>
</MudForm>
Expand All @@ -80,7 +80,6 @@
};
protected override async Task OnInitializedAsync()
{
_isOnline =await OnlineStatusInterop.GetOnlineStatusAsync();
var result = await ProductServiceProxy.GetProductByIdAsync(Id);
result.Switch(
dto =>
Expand All @@ -105,6 +104,12 @@
}
private async Task Save()
{
var online = await OnlineStatusInterop.GetOnlineStatusAsync();
if (!online)
{
Snackbar.Add(L["You are offline. Please check your internet connection."], Severity.Error);
return;
}
editForm?.Validate();
if (success == true)
{
Expand Down

0 comments on commit 4eb7c6b

Please sign in to comment.