mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 13:38:21 -05:00
♻️ refactor: start tracking page numbers from 0 instead of 1 in the backend (#467)
Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>
This commit is contained in:
parent
9f23a1c70b
commit
d073aa247a
@ -59,11 +59,11 @@ pub async fn search(
|
||||
)
|
||||
};
|
||||
|
||||
// .max(1) makes sure that the page > 0.
|
||||
let page = params.page.unwrap_or(1).max(1);
|
||||
// .max(1) makes sure that the page >= 0.
|
||||
let page = params.page.unwrap_or(1).max(1) - 1;
|
||||
|
||||
let (_, results, _) = join!(
|
||||
get_results(page - 1),
|
||||
get_results(page.saturating_sub(1)),
|
||||
get_results(page),
|
||||
get_results(page + 1)
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user