Created
May 26, 2022 19:10
-
-
Save JonEast87/b4b2ef3ba450be9200a350eec1040688 to your computer and use it in GitHub Desktop.
Modern_asynchronous_programming_Promise_all/src/main.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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