Fix issues

This commit is contained in:
BlossomiShymae
2024-08-09 18:13:14 -05:00
parent 9ba81ff48f
commit bc32f84919
3 changed files with 7 additions and 7 deletions

View File

@@ -26,7 +26,7 @@ namespace Needlework.Net.Desktop.ViewModels
[ObservableProperty] private string? _requestBody = null;
[ObservableProperty] private string? _responsePath = null;
[ObservableProperty] private string? _responseStatus = null;
[ObservableProperty] private string? _responseAuthentication = null;
[ObservableProperty] private string? _responseAuthorization = null;
public WindowService WindowService { get; }
@@ -65,20 +65,20 @@ namespace Needlework.Net.Desktop.ViewModels
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
var body = await response.Content.ReadAsStringAsync();
body = JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(body, App.JsonSerializerOptions));
body = !string.IsNullOrEmpty(body) ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(body), App.JsonSerializerOptions) : string.Empty;
if (body.Length >= App.MaxCharacters) WindowService.ShowOopsiesWindow(body);
else WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(body), nameof(ConsoleViewModel));
ResponseStatus = response.StatusCode.ToString();
ResponseStatus = $"{(int)response.StatusCode} {response.StatusCode.ToString()}";
ResponsePath = $"https://127.0.0.1:{processInfo.AppPort}{RequestPath}";
ResponseAuthentication = $"Basic {riotAuthentication.Value}";
ResponseAuthorization = $"Basic {riotAuthentication.Value}";
}
catch (Exception ex)
{
await SukiHost.ShowToast("Request Failed", ex.Message, SukiUI.Enums.NotificationType.Error);
ResponseStatus = null;
ResponsePath = null;
ResponseAuthentication = null;
ResponseAuthorization = null;
WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(string.Empty), nameof(ConsoleViewModel));
}
finally

View File

@@ -98,7 +98,7 @@ namespace Needlework.Net.Desktop.ViewModels
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
var responseBody = await response.Content.ReadAsStringAsync();
responseBody = JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody, App.JsonSerializerOptions));
responseBody = !string.IsNullOrEmpty(responseBody) ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), App.JsonSerializerOptions) : string.Empty;
if (responseBody.Length >= App.MaxCharacters) WeakReferenceMessenger.Default.Send(new OopsiesWindowRequestedMessage(responseBody));
else WeakReferenceMessenger.Default.Send(new EditorUpdateMessage(new(responseBody, "EndpointResponseEditor")));