Fatal broke (refactor)

This commit is contained in:
2024-07-14 21:15:00 +03:00
parent 6cd6b12630
commit 9ef4176091
10 changed files with 131 additions and 133 deletions

16
src/url/user.rs Normal file
View File

@ -0,0 +1,16 @@
pub async fn user(req: Request<Incoming>, pool: DBPool) -> Res<(String, StatusCode, HeaderValue), SkyError> {
let uri: &str = req.uri().path().as_ref();
let login = &uri[2..uri.len()];
let body: String;
let user = get_user(pool, login.to_string()).await;
if user.is_ok() {
body = format!("{}", user?.uuid);
}
else {
body = "Not fond :(".to_owned();
}
let restype: HeaderValue = "text/html".parse().unwrap();
Ok((build_html(&body), StatusCode::OK, restype))
}