mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-14 05:52:53 +00:00
Fixed Sorting
This commit is contained in:
parent
2c06ae1d8f
commit
05ea0fe1fd
10 changed files with 49 additions and 48 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue