summaryrefslogtreecommitdiff
path: root/nodejs/automation/init.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--nodejs/automation/init.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/nodejs/automation/init.ts b/nodejs/automation/init.ts
index 28163b7..7ec1252 100644
--- a/nodejs/automation/init.ts
+++ b/nodejs/automation/init.ts
@@ -1,12 +1,9 @@
-import * as dbAgents from '../database/agents.ts';
import * as db from '../database/db.ts';
import * as dbTokens from '../database/tokens.ts';
import {
Response,
} from '../lib/api.ts';
-import {
- Agent,
-} from '../lib/types.ts';
+import { Agent, initAgent, setAgent } from '../lib/agent.ts';
import { Contract } from '../lib/contracts.ts';
import { Ship } from '../lib/ships.ts';
import * as libContracts from '../lib/contracts.ts';
@@ -30,6 +27,7 @@ export async function init(): Promise<void> {
switch(json.error?.code) {
case 4111: // 4111 means the agent symbol has already been claimed so no server reset happened
// TODO await agents.agents();
+ await initAgent();
return;
default:
throw json;
@@ -37,5 +35,5 @@ export async function init(): Promise<void> {
}
db.reset();
dbTokens.addToken(json.data.token);
- dbAgents.addAgent(json.data.agent);
+ setAgent(json.data.agent);
}