@@ 13,6 13,30 @@ use crate::{error::api::APIError, types::user::UserPub};
use super::macros::extract_cookie;
+#[derive(Deserialize)]
+#[serde(untagged)]
+pub enum ResponseInfo {
+ Error(APIError),
+ Ok(UserPub),
+}
+
+#[derive(Deserialize)]
+pub struct ResponseInfoWrapper {
+ pub response: ResponseInfo,
+ pub cookie: String,
+}
+
+pub fn info(api_address: &str, user_id: &str) -> ResponseInfoWrapper {
+ let client = reqwest::blocking::Client::new();
+
+ let resp = client.get(&format!("{}/user", api_address)).send().unwrap();
+
+ ResponseInfoWrapper {
+ cookie: extract_cookie!(resp),
+ response: resp.json().unwrap(),
+ }
+}
+
#[derive(Serialize)]
pub struct PostLogin {
pub email: String,