Fixed Sorting

This commit is contained in:
spikecodes 2020-11-17 16:03:28 -08:00
parent 2c06ae1d8f
commit 05ea0fe1fd
10 changed files with 49 additions and 48 deletions

View file

@ -1,12 +1,15 @@
// CRATES
use actix_web::{get, web, HttpResponse, Result};
use askama::Template;
use serde::Deserialize;
#[path = "subreddit.rs"]
mod subreddit;
use subreddit::{posts, Post};
#[path = "utils.rs"]
mod utils;
use utils::{Params};
// STRUCTS
#[derive(Template)]
#[template(path = "popular.html", escape = "none")]
@ -15,11 +18,6 @@ struct PopularTemplate {
sort: String,
}
#[derive(Deserialize)]
pub struct Params {
sort: Option<String>,
}
// RENDER
async fn render(sub_name: String, sort: String) -> Result<HttpResponse> {
let posts: Vec<Post> = posts(sub_name, &sort).await;