Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
function getAllPoisOfType(poiTypeId, campusId) {
    let pois = [];
// Array to
store POIs     
    function recursivelyAddPois(responseres) {
        response.geojson.features.forEach(featurepois => pois.push(feature)concat(res.geojson.features); // PushConcatenate each POI feature to the features array
         if (!responseres.getNextPage) {
            return pois; // Return all POIs if there's no next page
        }
         // Fetch the next page of POIs if available
        return responseres.getNextPage().then(recursivelyAddPois);
    }

    // First API call using separate parameters
    return Mazemap.Data.getPoisByTypeIdAndCampusIdAsGeoJSONWithPagination(poiTypeId, campusId).then(recursivelyAddPois);
}

...