mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-14 22:13:17 -06:00
use page query param instead of separate API route
This commit is contained in:
@@ -98,10 +98,8 @@ def api_character_list():
|
|||||||
|
|
||||||
@current_app.route('/api/character/<character>/')
|
@current_app.route('/api/character/<character>/')
|
||||||
def api_character_all(character: str):
|
def api_character_all(character: str):
|
||||||
return jsonify(character_data[character])
|
if request.args['page']:
|
||||||
|
index: int = (int(request.args['page']) - 1) * 10
|
||||||
|
return jsonify(character_data[character][index: index + 10])
|
||||||
@current_app.route('/api/character/<character>/<int:page>/')
|
else:
|
||||||
def api_character_paged(character: str, page: int):
|
return jsonify(character_data[character])
|
||||||
index: int = (page - 1) * 10
|
|
||||||
return jsonify(character_data[character][index: index + 10])
|
|
||||||
|
|||||||
Reference in New Issue
Block a user