Add Additional Logging/Diagnostics For Weird Status Behaviours

This commit is contained in:
Alan Moon 2025-07-17 14:36:56 -07:00
parent 6bf77aa12e
commit 758a5a96dc
2 changed files with 7 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace QtCNETAPI.Services.ApiService
{
private User? user;
private RestClient _client;
private LoggingService _loggingService;
internal string? sessionToken;
internal string apiUri;
@ -30,9 +31,10 @@ namespace QtCNETAPI.Services.ApiService
get { return user; }
}
public ApiService(string apiUrl)
public ApiService(string apiUrl, LoggingService loggingService)
{
apiUri = apiUrl;
_loggingService = loggingService;
_client = new RestClient(apiUri);
}
@ -287,6 +289,9 @@ namespace QtCNETAPI.Services.ApiService
if (userResponse != null && userResponse.Success && userResponse.Data != null)
{
user = userResponse.Data;
_loggingService.LogString($"Current User's Status Is {userResponse.Data.Status}");
return userResponse.Data;
} else
{

View File

@ -53,7 +53,7 @@ namespace qtc_net_client_2
// instantiate new ApiService and GatewayService for this session
// this will keep the gateway thread in the main thread (i think)
IApiService api = new ApiService($"{clientConfig.ServerUrl}/api");
IApiService api = new ApiService($"{clientConfig.ServerUrl}/api", loggingService);
IGatewayService gateway = new GatewayService($"{clientConfig.ServerUrl}/chat", api, loggingService);
// ping api