auth-connector-fix-5

This commit is contained in:
Untone 2023-12-14 00:04:58 +03:00
parent e01c014ed1
commit 3fbaa984ef

View File

@ -33,15 +33,7 @@ async fn get_author_id(user: &str) -> Result<i32, Box<dyn Error>> {
.send() .send()
.await?; .await?;
if response.status().is_success() {
// Print the entire response body
let response_text = response.text().await?;
Err(Box::new(std::io::Error::new(
std::io::ErrorKind::Other,
format!("Server Response: {}", response_text)
)))
/* if response.status().is_success() {
let r: HashMap<String, serde_json::Value> = response.json().await?; let r: HashMap<String, serde_json::Value> = response.json().await?;
let author_id = r let author_id = r
.get("data") .get("data")
@ -67,7 +59,6 @@ async fn get_author_id(user: &str) -> Result<i32, Box<dyn Error>> {
format!("Request failed with status: {}", response.status()), format!("Request failed with status: {}", response.status()),
))) )))
} }
*/
} }
@ -90,7 +81,7 @@ pub async fn get_id_by_token(token: &str) -> Result<i32, Box<dyn Error>> {
"operationName": operation, "operationName": operation,
"variables": variables "variables": variables
}); });
// println!("GraphQL Query: {}", gql); println!("[get_id_by_token] GraphQL Query: {}", gql);
let client = HTTPClient::new(); let client = HTTPClient::new();
let response = client let response = client
.post(&auth_api_base) .post(&auth_api_base)