Fixed API refresh showing as failed due to incorrect response formatting.

This commit is contained in:
neviyn 2016-05-07 21:52:26 +01:00
parent c655bad631
commit 60bc7483b2
2 changed files with 4 additions and 2 deletions

View File

@ -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:<br>" + retData.last_refresh + "<br>Click to refresh");
$('#success-area').show();
).fail(() ->
$('#error-area').show();
$('#error-text').text("Cannot refresh API. Try again later.")

View File

@ -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