Make a request() utility

This commit is contained in:
spikecodes 2020-11-18 18:50:59 -08:00
parent f455e2095d
commit 0054557c86
8 changed files with 105 additions and 64 deletions

View file

@ -20,7 +20,7 @@ struct PopularTemplate {
// RENDER
async fn render(sub_name: String, sort: String) -> Result<HttpResponse> {
let posts: Vec<Post> = posts(sub_name, &sort).await;
let posts: Vec<Post> = posts(sub_name, &sort).await?;
let s = PopularTemplate { posts: posts, sort: sort }.render().unwrap();
Ok(HttpResponse::Ok().content_type("text/html").body(s))