diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index 7d85459..bd76fce 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -134,10 +134,12 @@ $("#get-help").click (e) -> $("#api-refresh").click (e) -> e.preventDefault(); $("#api-refresh").find('img').addClass('glyphicon-spin'); - $.post("/refresh").success(() -> + $.post("/refresh").success((retData) -> refreshQuestion(); $("#api-refresh").find('img').removeClass('glyphicon-spin'); + $("#api-refresh").attr('data-original-title', "Last API Refresh:
" + retData.last_refresh + "
Click to refresh"); $('#success-area').show(); + ).fail(() -> $('#error-area').show(); $('#error-text').text("Cannot refresh API. Try again later.") diff --git a/wanikaniburned.py b/wanikaniburned.py index 7ee230e..807bead 100644 --- a/wanikaniburned.py +++ b/wanikaniburned.py @@ -242,7 +242,7 @@ def get_items(): def refresh_api(): # pragma: no cover try: current_user.update_all() - return str(datetime_format(current_user.last_updated)), 202 + return flask.jsonify(last_refresh=datetime_format(current_user.last_updated)) except ValueError as err: logger.error("Error during /refresh. %s", str(err)) return str(err), 500