Currently, I am trying to implement code that I found in a SaaS's example. The goal is to retrieve the correct URL for a specific action. The sample code provided by the SaaS looks like this, but I would like to modify it so that it returns a Promise and can be utilized with await
in the code execution. However, I'm struggling to structure it correctly, there must be some reason causing the issue that I have not figured out yet.
fetchSourceUrl: async(customerInfo) => {
Saas.getSaasClient()
.post(`${customerInfo.customerUrl}/funding-sources`, customerInfo.requestBody)
.then(res => res.headers.get('location'));
}
In the process of executing the code...
const sourceUrl = await fetchSourceUrl(customerInfo);