From 68c457964a02d290f3fe225b090c549d664bb836 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 1 Jun 2023 01:11:21 +0200 Subject: Another big refactoring --- lib/agent.js | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 lib/agent.js (limited to 'lib/agent.js') 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)); -} -- cgit v1.2.3