mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-08 07:37:45 +00:00
Rewrite URL Dispatch
This commit is contained in:
parent
148d87fb45
commit
75bc170eba
7 changed files with 28 additions and 32 deletions
|
@ -1,6 +1,6 @@
|
|||
// CRATES
|
||||
use crate::utils::{fetch_posts, nested_val, request, ErrorTemplate, Params, Post, User};
|
||||
use actix_web::{get, http::StatusCode, web, HttpResponse, Result};
|
||||
use actix_web::{http::StatusCode, web, HttpResponse, Result};
|
||||
use askama::Template;
|
||||
|
||||
// STRUCTS
|
||||
|
@ -39,8 +39,7 @@ async fn render(username: String, sort: String) -> Result<HttpResponse> {
|
|||
}
|
||||
|
||||
// SERVICES
|
||||
#[get("/u/{username}")]
|
||||
async fn page(web::Path(username): web::Path<String>, params: web::Query<Params>) -> Result<HttpResponse> {
|
||||
pub 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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue