mirror of
https://github.com/Shchoholiev/shopping-assistant-web-client.git
synced 2025-04-03 16:19:48 +00:00
add error handling
This commit is contained in:
parent
31f94d32d0
commit
22d0311ec4
@ -38,39 +38,44 @@ public partial class Chat : ComponentBase
|
||||
private string name = "";
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var input = _searchServise.firstMassage;
|
||||
try{
|
||||
var input = _searchServise.firstMassage;
|
||||
|
||||
if (input!=null){
|
||||
if (input!=null){
|
||||
|
||||
await LoadMessages();
|
||||
await LoadMessages();
|
||||
|
||||
await AddNewMessage(input);
|
||||
await AddNewMessage(input);
|
||||
|
||||
string wishlistId = chatId;
|
||||
var request = new GraphQLRequest
|
||||
{
|
||||
Query = @"mutation GenerateNameForPersonalWishlist($wishlistId: String!) {
|
||||
generateNameForPersonalWishlist(wishlistId: $wishlistId) {
|
||||
id
|
||||
name
|
||||
}
|
||||
}",
|
||||
Variables = new
|
||||
{
|
||||
wishlistId
|
||||
|
||||
string wishlistId = chatId;
|
||||
var request = new GraphQLRequest
|
||||
{
|
||||
Query = @"mutation GenerateNameForPersonalWishlist($wishlistId: String!) {
|
||||
generateNameForPersonalWishlist(wishlistId: $wishlistId) {
|
||||
id
|
||||
name
|
||||
}
|
||||
}",
|
||||
Variables = new
|
||||
{
|
||||
wishlistId
|
||||
};
|
||||
|
||||
var response = await _apiClient.QueryAsync(request);
|
||||
_searchServise.SetFirstMassage(null);
|
||||
isLoading = false;
|
||||
await UpdateSideMenu(wishlistId);
|
||||
StateHasChanged();
|
||||
|
||||
}else{
|
||||
await LoadMessages();
|
||||
}
|
||||
};
|
||||
|
||||
var response = await _apiClient.QueryAsync(request);
|
||||
_searchServise.SetFirstMassage(null);
|
||||
isLoading = false;
|
||||
await UpdateSideMenu(wishlistId);
|
||||
StateHasChanged();
|
||||
|
||||
}else{
|
||||
await LoadMessages();
|
||||
}catch(Exception ex){
|
||||
Console.WriteLine($"Error OnInitializedAsync: {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user