I want to edit a res.json what callbacked(Promise.then) result is to associative array like this "{category:"tennis",data:res.json()}"
then I want to get a it without a Promise type
I tried it but It returned with Promise Type
const promise = new Promise(function(resolve,reject) {
fetch("http://localhost:100/api/v1/categories/map").then(response
=> resolve(response.json()))
});
promise.then(value => Promise.all(value.category.map(
category => {
return (fetch("http://localhost:100/api/v1/categoriescategory=tennis"))
}
))
.then(responses => {console.log(responses);
return Promise.all(responses.map(res=> {
console.log(res.json()) <- this is not Promise
return(
{category:"tennis",data:res.json()} <- this is Promise
)
} )
)}))
.then(value=>console.log(value)) // {{category:"tennis",Promise{data:data}} <- i want to unwrap Promise