summaryrefslogtreecommitdiff
path: root/lambda-calcul/javascript/src/client.js
diff options
context:
space:
mode:
Diffstat (limited to 'lambda-calcul/javascript/src/client.js')
-rw-r--r--lambda-calcul/javascript/src/client.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/lambda-calcul/javascript/src/client.js b/lambda-calcul/javascript/src/client.js
index 08b967d..e6b4fd3 100644
--- a/lambda-calcul/javascript/src/client.js
+++ b/lambda-calcul/javascript/src/client.js
@@ -16,11 +16,18 @@ const newClient = ({
})
.then(({ data: { expr } }) => expr);
+ const postSolution = (token, solution) => axios({
+ method: 'POST',
+ url: `${challengerURL}/api/challenge?token=${token}`,
+ headers: { 'Content-Type': 'application/json;charset=utf-8' },
+ data: solution,
+ });
+
const solve = (challenge) => {
const parsedExpression = parser.parse(challenge);
const evaluatedExpression = interpreter.evaluate(parsedExpression);
return printer.print(evaluatedExpression);
- }
+ };
const start = () => axios({
method: 'POST',
@@ -37,6 +44,7 @@ const newClient = ({
return {
nextChallenge,
+ postSolution,
solve,
start,
unregister,