HTTP Response Best Practice
May 5, 2021
Normally your response JSON contains data property. We just simply retrive data with simple format.
const { data } = response; // data = true
if(data){
// do something
}
Well, it is not well format. As a best practice, it is better to respond with well format.
const { data } = response;
const { isAvailable } = data; // data: { isAvailable: true }
if(data){
// do something
}