From 24708eb7983e63d44828ed81834289a4643b87e0 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Thu, 15 Aug 2024 09:20:31 +0200 Subject: [PATCH] push my ork --- OwnChar/Api/OwnCharApiClient.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OwnChar/Api/OwnCharApiClient.cs b/OwnChar/Api/OwnCharApiClient.cs index 3d4c51d..aa851fb 100644 --- a/OwnChar/Api/OwnCharApiClient.cs +++ b/OwnChar/Api/OwnCharApiClient.cs @@ -14,14 +14,16 @@ public class OwnCharApiClient internal string? AuthSecret { get; set; } = null; public bool IsLoggedIn => AuthSecret != null; + public string ApiUrl { get; } public LoginApiClient Auth { get; } public UsersApiClient Users { get; } public CharactersApiClient Characters { get; } public GroupsApiClient Groups { get; } - public OwnCharApiClient() + public OwnCharApiClient(string apiUrl) { + this.ApiUrl = apiUrl; Auth = GetClient(); Users = GetClient(); Characters = GetClient(); @@ -55,8 +57,9 @@ public class OwnCharApiClient { request.AuthSecret = AuthSecret; - var content = new StringContent(JsonHelpers.SerializeRequest(request)!, MediaTypeHeaderValue.Parse("application/json")); - var res = await httpClient.PostAsync(requestUrl, content); + var fullRequestUrl = ApiUrl + requestUrl; + var content = new StringContent(JsonHelpers.SerializeRequest(request)!, null, "application/json"); + var res = await httpClient.PostAsync(fullRequestUrl, content); if (res.IsSuccessStatusCode) return JsonHelpers.DeserializeResponse(await res.Content.ReadAsStringAsync());