From 1678245750b9377c7af18088d0687669350abc96 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:10:37 -0800 Subject: [PATCH] Add Sorting to Short Links --- src/post.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/post.rs b/src/post.rs index 3c45bc4..166162e 100644 --- a/src/post.rs +++ b/src/post.rs @@ -56,8 +56,11 @@ async fn render(id: String, sort: String) -> Result { } // SERVICES -pub async fn short(web::Path(id): web::Path) -> Result { - render(id.to_string(), "confidence".to_string()).await +pub async fn short(web::Path(id): web::Path, params: web::Query) -> Result { + match ¶ms.sort { + Some(sort) => render(id, sort.to_string()).await, + None => render(id, "confidence".to_string()).await, + } } pub async fn page(web::Path((_sub, id)): web::Path<(String, String)>, params: web::Query) -> Result {