Fatal broke (refactor)
This commit is contained in:
		
							
								
								
									
										16
									
								
								src/url/user.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/url/user.rs
									
									
									
									
									
										Normal 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)) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user