Correction fonction listWaypointsInSystem

michael
Makaci Michael Gabriel ago%!(EXTRA string=2 years)
parent 4430a4573c
commit 8fe3f4c54f
  1. 8
      systems.js

@ -44,11 +44,11 @@ export async function getSystem(systemSymbol){
return system; return system;
} }
export async function listWaypointsInSystem(limit, pages){ export async function listWaypointsInSystem(limit, pages, systemSymbol){
let waypoints = []; let waypoints = [];
for(let page = 1; page <= pages; page++){ for(let page = 1; page <= pages; page++){
await $.ajax('https://api.spacetraders.io/v2/systems/systemSymbol/waypoints', { await $.ajax(`https://api.spacetraders.io/v2/systems/${systemSymbol}/waypoints`, {
method: 'GET', method: 'GET',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
@ -58,8 +58,8 @@ export async function listWaypointsInSystem(limit, pages){
page: page page: page
}, },
success: function(response){ success: function(response){
response.data.forEach(sytem => { response.data.forEach(waypoint => {
systems.push(sytem); waypoints.push(waypoint);
}); });
}, },
error: function(error){ error: function(error){

Loading…
Cancel
Save