Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JonEast87/b4b2ef3ba450be9200a350eec1040688 to your computer and use it in GitHub Desktop.
Save JonEast87/b4b2ef3ba450be9200a350eec1040688 to your computer and use it in GitHub Desktop.
Modern_asynchronous_programming_Promise_all/src/main.js
const axios = require("../utils/axios");
const BASE_URL = "http://localhost:5000";
function bulkDelete(ids) {
const promises = ids.map((id) => {
const url = `${BASE_URL}/constellations/${id}`
return axios.delete(url)
.then((data) => {
console.log(data)
return { id }
})
})
return Promise.all(promises)
}
module.exports = {
bulkDelete,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment