mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-13 20:13:15 -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>/')
|
||||
def api_character_all(character: str):
|
||||
return jsonify(character_data[character])
|
||||
|
||||
|
||||
@current_app.route('/api/character/<character>/<int:page>/')
|
||||
def api_character_paged(character: str, page: int):
|
||||
index: int = (page - 1) * 10
|
||||
return jsonify(character_data[character][index: index + 10])
|
||||
if request.args['page']:
|
||||
index: int = (int(request.args['page']) - 1) * 10
|
||||
return jsonify(character_data[character][index: index + 10])
|
||||
else:
|
||||
return jsonify(character_data[character])
|
||||
|
||||
Reference in New Issue
Block a user