This commit is contained in:
2023-12-03 15:46:05 +01:00
parent a5e0857285
commit 2b133a9f3f
13 changed files with 779 additions and 152 deletions

View File

@@ -1,4 +1,6 @@
use ovlach_data::cv::cv::CV;
use ovlach_data::cv::data::CV;
use reqwest::Client;
use tracing::{debug, instrument};
#[derive(Debug)]
@@ -12,10 +14,14 @@ impl From<reqwest::Error> for FetchError {
}
}
pub async fn fetch_cv_data_from_backend(backend_host: String) -> Result<CV, FetchError> {
let resp = reqwest::get(format!("{}/{}", backend_host, "/api/cv/ovlach"))
#[instrument]
pub async fn fetch_cv_data_from_backend(backend_host: &String, person_name: &String, client: &Client) -> Result<CV, FetchError> {
let url = format!("{}/{}/{}", backend_host, "/api/v1/cv", person_name);
debug!("Fetching CV data from backend: {}", url);
let resp = client
.get(url).send()
.await?
.json::<CV>()
.await?;
Ok(resp)
}
}