I have these 2 sets of code. I am trying to retrieve an app_id in the resolver.
Code A:
let p1 = new Promise(function(resolve,reject){
axios({
method: 'POST',
url: url,
data: data,
headers: {'Content-Type': 'application/json' }
})
.then(response => {
//console.log(response.data)
final_output = {
"id":response.data
}
resolve(final_output)
})
.catch(error => {
//console.log("Error")
reject(error)
});
})
p1.then(function(final_output){
return final_output
})
and
Code B:
return new Promise(function(resolve,reject){
axios({
method: 'POST',
url: url,
data: data,
headers: {'Content-Type': 'application/json' }
})
.then(response => {
console.log(response.data)
final_output = {
"id":response.data
}
resolve(final_output)
})
.catch(error => {
console.log("Error")
reject(error)
});
})
I do not understand why Code B would return {"id":1} while Code A would not return {"id:1} to my graphql playground.