Fixed API refresh showing as failed due to incorrect response formatting.
This commit is contained in:
parent
c655bad631
commit
60bc7483b2
@ -134,10 +134,12 @@ $("#get-help").click (e) ->
|
|||||||
$("#api-refresh").click (e) ->
|
$("#api-refresh").click (e) ->
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$("#api-refresh").find('img').addClass('glyphicon-spin');
|
$("#api-refresh").find('img').addClass('glyphicon-spin');
|
||||||
$.post("/refresh").success(() ->
|
$.post("/refresh").success((retData) ->
|
||||||
refreshQuestion();
|
refreshQuestion();
|
||||||
$("#api-refresh").find('img').removeClass('glyphicon-spin');
|
$("#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();
|
$('#success-area').show();
|
||||||
|
|
||||||
).fail(() ->
|
).fail(() ->
|
||||||
$('#error-area').show();
|
$('#error-area').show();
|
||||||
$('#error-text').text("Cannot refresh API. Try again later.")
|
$('#error-text').text("Cannot refresh API. Try again later.")
|
||||||
|
@ -242,7 +242,7 @@ def get_items():
|
|||||||
def refresh_api(): # pragma: no cover
|
def refresh_api(): # pragma: no cover
|
||||||
try:
|
try:
|
||||||
current_user.update_all()
|
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:
|
except ValueError as err:
|
||||||
logger.error("Error during /refresh. %s", str(err))
|
logger.error("Error during /refresh. %s", str(err))
|
||||||
return str(err), 500
|
return str(err), 500
|
||||||
|
Loading…
Reference in New Issue
Block a user