diff options
Diffstat (limited to 'nodejs')
-rw-r--r-- | nodejs/lib/ships.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nodejs/lib/ships.js b/nodejs/lib/ships.js index d75d78e..eb59013 100644 --- a/nodejs/lib/ships.js +++ b/nodejs/lib/ships.js @@ -1,5 +1,4 @@ import * as api from './api.js'; -import * as dbConfig from '../database/config.js'; import * as dbShips from '../database/ships.js'; import * as dbSurveys from '../database/surveys.js'; import * as systems from '../lib/systems.js'; @@ -152,6 +151,15 @@ export async function sell(ctx) { return response; } +export async function ships() { + const response = await api.send({endpoint: `/my/ships`, page: 1}); + if (response.error !== undefined) { + throw response; + } + response.forEach(ship => dbShips.setShip(ship)); + return response; +} + export async function ship(ctx) { const response = await api.send({endpoint: `/my/ships/${ctx.symbol}`}); if (response.error !== undefined) { |