This commit is contained in:
2023-11-26 18:40:12 +01:00
parent 7934c5bfaa
commit b65b1a7a54
10 changed files with 399 additions and 47 deletions

21
src/services/cv.rs Normal file
View File

@@ -0,0 +1,21 @@
use ovlach_data::cv::cv::CV;
#[derive(Debug)]
pub enum FetchError {
ReqwestError(reqwest::Error)
}
impl From<reqwest::Error> for FetchError {
fn from(e: reqwest::Error) -> Self {
FetchError::ReqwestError(e)
}
}
pub async fn fetch_cv_data_from_backend(backend_host: String) -> Result<CV, FetchError> {
let resp = reqwest::get(format!("{}/{}", backend_host, "/api/cv/ovlach"))
.await?
.json::<CV>()
.await?;
Ok(resp)
}

1
src/services/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub mod cv;