[node] Added agent class, and fixed contract updates
This commit is contained in:
parent
9d48b58d7f
commit
6504e44ffa
6 changed files with 61 additions and 44 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue