backend: handle paged /tag/:tag_id_or_name from API
This commit is contained in:
parent
065d5a9d88
commit
82aeb0c536
@ -107,9 +107,12 @@ get "/tags" => sub {
|
||||
};
|
||||
|
||||
get "/tag/:tag_id_or_name" => sub {
|
||||
my $page = query_parameters->get("page") // 1;
|
||||
send_error("Invalid page number", 400) if !validate_page_number($page);
|
||||
|
||||
my $tag_id_or_name = route_parameters->get("tag_id_or_name");
|
||||
|
||||
my $res = api_get("/tag/$tag_id_or_name");
|
||||
my $res = api_get("/tag/$tag_id_or_name", { page => $page });
|
||||
send_error("API error", 500) if !$res->{success};
|
||||
|
||||
my $data = decode_json($res->{content});
|
||||
@ -122,6 +125,7 @@ get "/tag/:tag_id_or_name" => sub {
|
||||
template "gallery" => {
|
||||
title => $data->{name},
|
||||
media => \@media,
|
||||
pager => nav_pager($data->{pager}, "/tag/$tag_id_or_name"),
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user