summaryrefslogtreecommitdiff
path: root/lambda-calcul/javascript/src
diff options
context:
space:
mode:
authorEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 20:26:00 +0100
committerEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 22:00:26 +0100
commit800f5628d86313c315d38e983318bb0a027137e2 (patch)
treef5637077f0782fb9c8c1b15fb16274f4b5ee03fb /lambda-calcul/javascript/src
parent487fd6802ef2cb248dbabd804fac2ae4c91e76e9 (diff)
downloadlambda-nantes-800f5628d86313c315d38e983318bb0a027137e2.tar.gz
Retrieve next challenge
Diffstat (limited to 'lambda-calcul/javascript/src')
-rw-r--r--lambda-calcul/javascript/src/client.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lambda-calcul/javascript/src/client.js b/lambda-calcul/javascript/src/client.js
index d2de0d4..d046187 100644
--- a/lambda-calcul/javascript/src/client.js
+++ b/lambda-calcul/javascript/src/client.js
@@ -1,6 +1,11 @@
const axios = require('axios');
const newClient = ({ playerName, challengerURL }) => {
+ const nextChallenge = (token) => axios ({
+ url: `${challengerURL}/api/challenge?token=${token}`,
+ })
+ .then(({ data: { expr } }) => expr);
+
const start = () => axios({
method: 'POST',
url: `${challengerURL}/api/register`,
@@ -10,6 +15,7 @@ const newClient = ({ playerName, challengerURL }) => {
.then(({ data }) => data);
return {
+ nextChallenge,
start,
};
};