Use the database cache for mining and contracting automations
This commit is contained in:
parent
e18c5b1fdf
commit
28b3a695dc
3 changed files with 25 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as api from './api.js';
|
||||
import * as dbShips from '../database/ships.js';
|
||||
|
||||
export async function accept(ctx) {
|
||||
return await api.send({endpoint: `/my/contracts/${ctx.contract}/accept`, method: 'POST'});
|
||||
|
@ -9,11 +10,15 @@ export async function contracts() {
|
|||
}
|
||||
|
||||
export async function deliver(ctx) {
|
||||
return await api.send({ endpoint: `/my/contracts/${ctx.contract}/deliver`, method: 'POST', payload: {
|
||||
const response = await api.send({ endpoint: `/my/contracts/${ctx.contract}/deliver`, method: 'POST', payload: {
|
||||
shipSymbol: ctx.symbol,
|
||||
tradeSymbol: ctx.good,
|
||||
units: ctx.units,
|
||||
}});
|
||||
if (response.error !== undefined) {
|
||||
throw response;
|
||||
}
|
||||
dbShips.setShipCargo(ctx.symbol, response.data.cargo);
|
||||
}
|
||||
|
||||
export async function fulfill(ctx) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue