This commit is contained in:
Đăng Nguyễn
2025-12-30 16:59:08 +07:00
parent 2785a8f161
commit b3f765d261
11 changed files with 88 additions and 75 deletions

View File

@@ -84,7 +84,7 @@
new JsonSerializerOptions
{
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
});
}
private async Task OpenImportDialog()
@@ -220,7 +220,12 @@
try
{
var orderMsg = JsonSerializer.Deserialize<OrderMsg>(OrderJson);
var orderMsg = JsonSerializer.Deserialize<OrderMsg>(OrderJson,
new JsonSerializerOptions
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
});
if (orderMsg is null)
{
Snackbar.Add("Unable to convert JSON to Order", Severity.Warning);
@@ -251,20 +256,17 @@
}
}
var response = await Http.PostAsJsonAsync(
"/api/order",
JsonSerializer.Deserialize<OrderMsg>(OrderJson)
);
var response = await Http.PostAsJsonAsync("/api/order",orderMsg);
sendSuccess = response.IsSuccessStatusCode;
}
catch(JsonException jsonEx)
{
Snackbar.Add($"Json to Order failed: {jsonEx.Message}", Severity.Warning);
}
catch
catch (Exception ex)
{
Snackbar.Add($"Send Order failed: {ex.Message}", Severity.Warning);
sendSuccess = false;
}