diff --git a/src/data.rs b/src/data.rs index 81a924c..d11ca4f 100644 --- a/src/data.rs +++ b/src/data.rs @@ -34,8 +34,7 @@ pub async fn get_auth_id(token: &str) -> Result> { async fn get_shout_followers(shout_id: &str) -> Result, Box> { let api_base = env::var("API_BASE")?; - let gql = format!(r#" - query {{ + let gql = format!(r#"query ShoutFollowers {{ shoutFollowers(shout: {}) {{ follower {{ id @@ -43,10 +42,15 @@ async fn get_shout_followers(shout_id: &str) -> Result, Box> }} }} "#, shout_id); + let body = format!(r#"{{ + "query": "{}", + "operationName": "ShoutFollowers", + "variables": {{}} + }}"#, gql); let client = reqwest::Client::new(); let response = client .post(&api_base) - .body(gql) + .body(body) .send() .await?; diff --git a/src/main.rs b/src/main.rs index 3ea2341..43c279a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,12 +120,9 @@ async fn main() -> std::io::Result<()> { HttpServer::new(move || { println!("Webserver initialized"); App::new() - .wrap(Logger::default()) // Added this line + .wrap(Logger::default()) .app_data(web::Data::new(state.clone())) - .service( - web::scope("") - .route("/", web::get().to(connect_handler)) - ) + .route("/", web::get().to(connect_handler)) }) .bind("127.0.0.1:8080")? .run()