blob: e4f24f102a6f701921272379b05b88f7cec1e73f (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
import db from '../database/db.js';
import * as dbSystems from '../database/systems.js';
import * as api from '../lib/api.js';
export async function init() {
const response = await api.send({endpoint: `/systems`, page: Math.max(1, Math.floor(dbSystems.getSystemsCount()/20)), priority: 100});
if (response.error !== undefined) {
throw response;
}
db.transaction(() => response.forEach(function(system) { try { dbSystems.addSystem(system); } catch {} }))();
}
|