Umi: Umi Request. Support Path in the url

Created on 11 May 2019  ·  3Comments  ·  Source: umijs/umi

Hello team, thanks for incredible lib.
But I cannot find the way to replace id in url
example:
I want "/api/v1/import/orders/14/products"
so
return request(/api/v1/import/orders/:id/products, {
method: 'PUT',
params :{id: params.body.id},
data: {
...params.body,
},

});

but it does not . please suggest. thanks

pkg(umi-request) wontfix

Most helpful comment

You can write like this:

request(`/api/v1/import/orders/${params.body.id}/products`, {
  method: 'PUT',
  data: {
  ...params.body,
  },
});

All 3 comments

@clock157 Do we support this?

You can write like this:

request(`/api/v1/import/orders/${params.body.id}/products`, {
  method: 'PUT',
  data: {
  ...params.body,
  },
});

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings