We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d502217 commit 0d93128Copy full SHA for 0d93128
1 file changed
src/blog/handlers.rs
@@ -10,6 +10,8 @@ use crate::user::handlers::Admin;
10
#[derive(Debug, Deserialize)]
11
struct Pagination {
12
page: Option<u32>,
13
+ #[serde(rename = "pageSize")]
14
+ page_size: Option<u32>,
15
}
16
17
#[post("/posts/blur")]
@@ -25,7 +27,7 @@ pub async fn list_posts(
25
27
pool: web::Data<DbPool>,
26
28
web::Query(pagination): web::Query<Pagination>
29
) -> impl Responder {
- let page_size = 12;
30
+ let page_size = pagination.page_size.unwrap_or(8).max(1) as i64;
31
32
let (limit, offset) = if let Some(page_num) = pagination.page {
33
let page_num = page_num.max(1);
0 commit comments