mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-11 02:06:26 +00:00
initial commit
This commit is contained in:
18
src/server/backend.rs
Normal file
18
src/server/backend.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use serde::de::DeserializeOwned;
|
||||
use std::collections::HashMap;
|
||||
|
||||
static BACKEND_URL: &'static str = "backend.beammp.com";
|
||||
static AUTH_URL: &'static str = "auth.beammp.com";
|
||||
|
||||
pub async fn authentication_request<R: DeserializeOwned>(
|
||||
target: &str,
|
||||
map: HashMap<String, String>,
|
||||
) -> anyhow::Result<R> {
|
||||
let client = reqwest::Client::new();
|
||||
let resp = client
|
||||
.post(format!("https://{}/{}", AUTH_URL, target))
|
||||
.json(&map)
|
||||
.send()
|
||||
.await?;
|
||||
Ok(resp.json().await?)
|
||||
}
|
||||
Reference in New Issue
Block a user