summaryrefslogtreecommitdiff
path: root/nodejs/lib
diff options
context:
space:
mode:
authorJulien Dessaux2023-09-02 02:16:42 +0200
committerJulien Dessaux2023-09-02 02:16:42 +0200
commite03bb9061103cb11cd3c55a32fa688bde8c01e3b (patch)
treeb8848f1ef2d61c9c1e836c822542a2f45d54d043 /nodejs/lib
parent[javascript] began reworking token handling to match what is done with the ha... (diff)
downloadspacetraders-e03bb9061103cb11cd3c55a32fa688bde8c01e3b.tar.gz
spacetraders-e03bb9061103cb11cd3c55a32fa688bde8c01e3b.tar.bz2
spacetraders-e03bb9061103cb11cd3c55a32fa688bde8c01e3b.zip
[javascript] added contracts and agent database management
Diffstat (limited to 'nodejs/lib')
-rw-r--r--nodejs/lib/contracts.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/nodejs/lib/contracts.js b/nodejs/lib/contracts.js
index 316e181..e4ba2ae 100644
--- a/nodejs/lib/contracts.js
+++ b/nodejs/lib/contracts.js
@@ -1,3 +1,4 @@
+import * as dbContracts from '../database/contracts.js';
import * as api from './api.js';
import * as dbShips from '../database/ships.js';
@@ -6,7 +7,9 @@ export async function accept(ctx) {
}
export async function contracts() {
- return await api.send({endpoint: '/my/contracts'});
+ const contracts = await api.send({endpoint: '/my/contracts', page: 1});
+ contracts.forEach(contract => dbContracts.setContract(contract));
+ return contracts;
}
export async function deliver(ctx) {