mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-08 15:47:48 +00:00
Fixed Sorting
This commit is contained in:
parent
2c06ae1d8f
commit
05ea0fe1fd
10 changed files with 49 additions and 48 deletions
14
src/user.rs
14
src/user.rs
|
@ -5,7 +5,7 @@ use chrono::{TimeZone, Utc};
|
|||
|
||||
#[path = "utils.rs"]
|
||||
mod utils;
|
||||
use utils::{Flair, Post, User, val, nested_val};
|
||||
use utils::{Params, Flair, Post, User, val, nested_val};
|
||||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
|
@ -26,13 +26,11 @@ async fn render(username: String, sort: String) -> Result<HttpResponse> {
|
|||
|
||||
// SERVICES
|
||||
#[get("/u/{username}")]
|
||||
async fn page(web::Path(username): web::Path<String>) -> Result<HttpResponse> {
|
||||
render(username, "hot".to_string()).await
|
||||
}
|
||||
|
||||
#[get("/u/{username}/{sort}")]
|
||||
async fn sorted(web::Path((username, sort)): web::Path<(String, String)>) -> Result<HttpResponse> {
|
||||
render(username, sort).await
|
||||
async fn page(web::Path(username): web::Path<String>, params: web::Query<Params>) -> Result<HttpResponse> {
|
||||
match ¶ms.sort {
|
||||
Some(sort) => render(username, sort.to_string()).await,
|
||||
None => render(username, "hot".to_string()).await,
|
||||
}
|
||||
}
|
||||
|
||||
// USER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue