summaryrefslogtreecommitdiff
path: root/lambda-calcul/javascript/src/client.js
diff options
context:
space:
mode:
authorEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 22:27:27 +0100
committerEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 22:27:27 +0100
commit2ac732dc527d53974d65a5afbb33c452a567797b (patch)
treebe422f4d47652dd92552302c9bcb5bd954839cf5 /lambda-calcul/javascript/src/client.js
parent1b1877e3328170fe839d2f8ca4d108ec2b0a0454 (diff)
downloadlambda-nantes-2ac732dc527d53974d65a5afbb33c452a567797b.tar.gz
Post solution
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,