Change the next question routes to include a no content status code
This commit is contained in:
parent
5519b04a46
commit
9da0104e73
@ -84,7 +84,7 @@ def next_hidden_answer():
|
||||
return jsonify(next_question.get_dict())
|
||||
else:
|
||||
session.pop("hidden_answer_ids", None)
|
||||
return jsonify(None)
|
||||
return jsonify(None), 204
|
||||
|
||||
|
||||
@app.route("/category/multiple_choice/next_question")
|
||||
@ -99,7 +99,7 @@ def next_multiple_choice():
|
||||
return jsonify(next_question.get_dict_shuffled_choices())
|
||||
else:
|
||||
session.pop("multiple_choice_ids", None)
|
||||
return jsonify(None)
|
||||
return jsonify(None), 204
|
||||
|
||||
|
||||
@app.route("/login", methods=["GET", "POST"])
|
||||
|
@ -19,7 +19,16 @@ function get_new_question(difficulty) {
|
||||
dataType: "json",
|
||||
success: (data, textStatus, jqXHR) => {
|
||||
control_btns.attr("disabled", false);
|
||||
if (textStatus !== "nocontent") {
|
||||
question_received(data);
|
||||
} else {
|
||||
question_received(textStatus);
|
||||
}
|
||||
},
|
||||
error: (jqXHR, textStatus, errorThrown) => {
|
||||
control_btns.attr("disabled", false);
|
||||
console.log(textStatus);
|
||||
console.log(errorThrown);
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -57,6 +66,7 @@ function previous_question() {
|
||||
function question_received(data) {
|
||||
let difficulty = questions[current_difficulty-1];
|
||||
if (data) {
|
||||
if (data !== "nocontent") {
|
||||
difficulty["questions"].push(data);
|
||||
difficulty["current_question"] += 1;
|
||||
update_question();
|
||||
@ -65,3 +75,4 @@ function question_received(data) {
|
||||
update_question();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user