Skip to content

Commit a2a8542

Browse files
committed
DOC-204 begin warehouse function
1 parent 6d8ec83 commit a2a8542

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/papi.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,20 @@ const updateDestinations = async () => {
399399
output += "# destination categories last updated " + todayDate + " \n";
400400
output += yaml.safeDump({ items: destinationCategories }, options);
401401
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/destination_categories.yml`), output);
402+
}
402403

404+
const updateWarehouses = async () => {
405+
while (nextPageToken !== null) {
406+
const res = await getCatalog(`${PAPI_URL}/catalog/warehouses/`, nextPageToken)
407+
destinations = destinations.concat(res.data.destinationsCatalog)
408+
nextPageToken = res.data.pagination.next
409+
}
403410

404-
411+
destinations.sort((a, b) => {
412+
if(a.name < b.name) { return -1; }
413+
if(a.name > b.name) { return 1; }
414+
return 0;
415+
})
405416
}
406417

407418
updateDestinations()

0 commit comments

Comments
 (0)