diff options
Diffstat (limited to 'lambda-calcul/javascript/src')
| -rw-r--r-- | lambda-calcul/javascript/src/client.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lambda-calcul/javascript/src/client.js b/lambda-calcul/javascript/src/client.js new file mode 100644 index 0000000..d2de0d4 --- /dev/null +++ b/lambda-calcul/javascript/src/client.js @@ -0,0 +1,19 @@ +const axios = require('axios'); + +const newClient = ({ playerName, challengerURL }) => { + const start = () => axios({ + method: 'POST', + url: `${challengerURL}/api/register`, + headers: { 'Content-Type': 'application/json;charset=utf-8' }, + data: playerName, + }) + .then(({ data }) => data); + + return { + start, + }; +}; + +module.exports = { + newClient, +}; |
