mirror of
https://github.com/Xevion/trivia.git
synced 2025-12-09 20:08:49 -06:00
implemented refresh with custom namedtuple json serialization workaround, changed switch to jsonify
This commit is contained in:
@@ -5,7 +5,7 @@ Handles backend routes assisting
|
||||
"""
|
||||
import json
|
||||
|
||||
from flask import request
|
||||
from flask import request, jsonify, make_response
|
||||
|
||||
from trivia import app
|
||||
from trivia.utils import lastModified
|
||||
@@ -23,7 +23,7 @@ def changed():
|
||||
"""
|
||||
from trivia.utils import lastChange
|
||||
time = int(request.args.get('last') or lastModified())
|
||||
return json.dumps(lastChange < time)
|
||||
return jsonify(lastChange < time)
|
||||
|
||||
|
||||
@app.route("/api/refresh")
|
||||
@@ -32,3 +32,8 @@ def refresh():
|
||||
"""
|
||||
Used for refreshing client-side table data. Returns a JSON response with all data necessary to build the table.
|
||||
"""
|
||||
from trivia.utils import teams
|
||||
r = make_response(json.dumps([team._asdict() for team in teams]))
|
||||
print(r)
|
||||
r.mimetype = 'application/json'
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user