From 2ac732dc527d53974d65a5afbb33c452a567797b Mon Sep 17 00:00:00 2001 From: Emmanuel Gaillot Date: Sat, 20 Dec 2025 22:27:27 +0100 Subject: Post solution --- lambda-calcul/javascript/src/client.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lambda-calcul/javascript/src') 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, -- cgit v1.3.1