In the firebase docs they say that you should return a promise after a async operation
"To return data after an asynchronous operation, return a promise."
https://firebase.google.com/docs/functions/callable#sending_back_the_result
In the example they use a then to return a message to the client after the async operation finishes. But what about when I use await? Can I just return a object or do I have to wrap it inside a promise?
const response = await fetch('ttps://sandbox.itunes.apple.com/verifyReceipt', options);
if (response.status === 200)
return {
status: 200,
message: "Subscription verification successfuly!"
}
or
if (response.status === 200)
return Promise.resolve({
status: 200,
message: "Subscription verification successfuly!"
});