charon
charon
CC#
Created by charon on 5/6/2024 in #help
Help with request in wpf
Hi so im making this post request to get token from body but i just want to set that response as text in wpf so i just test it works
string json = JsonConvert.SerializeObject("{\"type\":\"email\",\"username\":\"tropeal21@gmail.com\",\"password\":\"Test123!\"}");
var httpContent = new StringContent(json, Encoding.UTF8, "application/json");
var httpResponse = await client.PostAsync("https://api.staging.pentagon.games/user/login", httpContent);
var responseString = await httpResponse.Content.ReadAsStringAsync();
BarkinCraft.info = responseString;
string json = JsonConvert.SerializeObject("{\"type\":\"email\",\"username\":\"tropeal21@gmail.com\",\"password\":\"Test123!\"}");
var httpContent = new StringContent(json, Encoding.UTF8, "application/json");
var httpResponse = await client.PostAsync("https://api.staging.pentagon.games/user/login", httpContent);
var responseString = await httpResponse.Content.ReadAsStringAsync();
BarkinCraft.info = responseString;
so it gets repsonse and sets it in this info variable so it can be used in main BarkinCraft class where it is set as text of label in gui on form load just to test response
5 replies