void QuizSubmission::complete(Session& session, AsyncCallback callback) { JSONValue document; document["validation_token"] = validationToken(); document["attempt"] = attempt(); document["access_code"] = mQuiz->accessCode(); session.post( url() + "/complete", document.toStyledString(), [&, callback](bool success, HTTP::Response response) { callback(success); }); }
void QuizSubmission::save(QuizQuestion const* qq, JSONValue &document, Session &session, AsyncCallback callback) const { document["validation_token"] = validationToken(); document["attempt"] = attempt(); document["access_code"] = mQuiz->accessCode(); session.put(qq->answerUrl(*this), document.toStyledString(), [&, callback](bool success, HTTP::Response response) { if (!success) { if (callback) { callback(false); } return; } if (callback) { callback(true); } }); }