trytofix
This commit is contained in:
parent
5526ebe7c9
commit
9dff03fe1a
10
src/data.rs
10
src/data.rs
|
@ -34,8 +34,7 @@ pub async fn get_auth_id(token: &str) -> Result<i32, Box<dyn Error>> {
|
||||||
|
|
||||||
async fn get_shout_followers(shout_id: &str) -> Result<Vec<i32>, Box<dyn Error>> {
|
async fn get_shout_followers(shout_id: &str) -> Result<Vec<i32>, Box<dyn Error>> {
|
||||||
let api_base = env::var("API_BASE")?;
|
let api_base = env::var("API_BASE")?;
|
||||||
let gql = format!(r#"
|
let gql = format!(r#"query ShoutFollowers {{
|
||||||
query {{
|
|
||||||
shoutFollowers(shout: {}) {{
|
shoutFollowers(shout: {}) {{
|
||||||
follower {{
|
follower {{
|
||||||
id
|
id
|
||||||
|
@ -43,10 +42,15 @@ async fn get_shout_followers(shout_id: &str) -> Result<Vec<i32>, Box<dyn Error>>
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
"#, shout_id);
|
"#, shout_id);
|
||||||
|
let body = format!(r#"{{
|
||||||
|
"query": "{}",
|
||||||
|
"operationName": "ShoutFollowers",
|
||||||
|
"variables": {{}}
|
||||||
|
}}"#, gql);
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
let response = client
|
let response = client
|
||||||
.post(&api_base)
|
.post(&api_base)
|
||||||
.body(gql)
|
.body(body)
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
@ -120,12 +120,9 @@ async fn main() -> std::io::Result<()> {
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
println!("Webserver initialized");
|
println!("Webserver initialized");
|
||||||
App::new()
|
App::new()
|
||||||
.wrap(Logger::default()) // Added this line
|
.wrap(Logger::default())
|
||||||
.app_data(web::Data::new(state.clone()))
|
.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")?
|
.bind("127.0.0.1:8080")?
|
||||||
.run()
|
.run()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user