summaryrefslogtreecommitdiff
path: root/lib/agent.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/agent.js')
-rw-r--r--lib/agent.js34
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/agent.js b/lib/agent.js
deleted file mode 100644
index bf27e85..0000000
--- a/lib/agent.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import { registerAgent } from '../database/config.js';
-
-// This function inits the database in case we have an already registered game
-export function init(symbol, faction, token) {
- registerAgent(symbol, faction, token);
- // TODO ships
- // TODO contract
- // TODO agent
-}
-
-// This function registers then inits the database
-export function register(symbol, faction) {
- fetch(
- 'https://api.spacetraders.io/v2/register',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- symbol: symbol,
- faction: faction,
- }),
- })
- .then(response => response.json())
- .then(response => {
- console.log(JSON.stringify(response, null, 2));
- init(symbol, faction, response.data.token);
- // TODO ship
- // TODO contract
- // TODO agent
- })
- .catch(err => console.error(err));
-}