Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Why do I keep getting Promise<Pending> when using API?

Use await or then when using API.

If you do not use await or then with api, quoteAPI, or other API’s, they will not yield any results, as all parameters within Interceptor Methods are Promises.

Incorrect

export const quotesDetailSubmitPre = async ({ api: { crmManager } }) => {
  const payload = crmManager.getPayload()
  console.log(payload) // returns {Promise pending}
}

Correct

export const quotesDetailSubmitPre = async ({ api: { crmManager } }) => {
  const payload = await crmManager.getPayload()
  console.log(payload) // returns {id: '123', name: 'pricefx Pivo a Párek' ...}
}
  • No labels