auth-connector-fix-5
This commit is contained in:
parent
e01c014ed1
commit
3fbaa984ef
15
src/data.rs
15
src/data.rs
|
@ -33,15 +33,7 @@ async fn get_author_id(user: &str) -> Result<i32, Box<dyn Error>> {
|
|||
.send()
|
||||
.await?;
|
||||
|
||||
|
||||
// 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() {
|
||||
if response.status().is_success() {
|
||||
let r: HashMap<String, serde_json::Value> = response.json().await?;
|
||||
let author_id = r
|
||||
.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()),
|
||||
)))
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,7 +81,7 @@ pub async fn get_id_by_token(token: &str) -> Result<i32, Box<dyn Error>> {
|
|||
"operationName": operation,
|
||||
"variables": variables
|
||||
});
|
||||
// println!("GraphQL Query: {}", gql);
|
||||
println!("[get_id_by_token] GraphQL Query: {}", gql);
|
||||
let client = HTTPClient::new();
|
||||
let response = client
|
||||
.post(&auth_api_base)
|
||||
|
@ -98,7 +89,7 @@ pub async fn get_id_by_token(token: &str) -> Result<i32, Box<dyn Error>> {
|
|||
.json(&gql)
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
|
||||
if response.status().is_success() {
|
||||
let r: HashMap<String, serde_json::Value> = response.json().await?;
|
||||
let user_id = r
|
||||
|
|
Loading…
Reference in New Issue
Block a user