Fix responses not being set to empty on oopsies

This commit is contained in:
BlossomiShymae
2024-08-10 06:09:48 -05:00
parent 4d6e04acb8
commit 360a0f28c7
2 changed files with 10 additions and 2 deletions

View File

@@ -66,7 +66,11 @@ namespace Needlework.Net.Desktop.ViewModels
var body = await response.Content.ReadAsStringAsync();
body = !string.IsNullOrEmpty(body) ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(body), App.JsonSerializerOptions) : string.Empty;
if (body.Length >= App.MaxCharacters) WindowService.ShowOopsiesWindow(body);
if (body.Length >= App.MaxCharacters)
{
WindowService.ShowOopsiesWindow(body);
WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(string.Empty), nameof(ConsoleViewModel));
}
else WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(body), nameof(ConsoleViewModel));
ResponseStatus = $"{(int)response.StatusCode} {response.StatusCode.ToString()}";