Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array.map requests causes error #26

Open
aleksejssaburovs92 opened this issue Jun 14, 2020 · 2 comments
Open

array.map requests causes error #26

aleksejssaburovs92 opened this issue Jun 14, 2020 · 2 comments

Comments

@aleksejssaburovs92
Copy link

aleksejssaburovs92 commented Jun 14, 2020

Using construction of

const data = await Promise.all(
  Object.values(this.orders).map(
    async (order) =>
      // await this.$axios.$get(`/authenticated/site/client/order/${order.id}`)
      await this.$api.auth.use('data').getClientTicketByOrderId({
        id: order.id
      })
  )
)

Causes error

TypeError: Cannot read property 'data' of null
    at eval (axios-actions.esm.js?2d04:491)
    at eval (axios-actions.esm.js?2d04:288)
    at Array.forEach (<anonymous>)
    at eval (axios-actions.esm.js?2d04:287)

Changing to normal axios request inside async function, works as expected

@davestewart
Copy link
Owner

Hey, I'm finding it a bit hard to work on OS at the moment.

Is this a blocker for you?

@aleksejssaburovs92
Copy link
Author

For now, i just changed

await this.$api.auth.use('data').getClientTicketByOrderId({
    id: order.id
})

to

await this.$axios.$get(`/authenticated/site/client/order/${order.id}`)

and it works ok, but it would be great if you could reproduce and fix it, because this approach causes me to move away endpoint from ApiGroup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants