Desarol / drupal-jsonapi-client

MIT License
18 stars 7 forks source link

do you support cross site requests & fetch configuration? #33

Closed laurencefass closed 2 years ago

laurencefass commented 2 years ago

Do you support cross-site requests? The example code in the readme looks like its assuming same-origin.

  const Entity = window.DrupalJsonApi.Entity

  Entity
  .Load('node', 'article', 'uuid')
  .then(entity => {
    console.log(entity)
  })

This looks like quite a high level API (which is great!) but can I configure it and specify the URL and set up the necessary headers to make this work?

Thanks

Auspicus commented 2 years ago

Hey @laurencefass, you can use either middleware or transport parameters for the Client as seen here: https://github.com/Desarol/drupal-jsonapi-client/blob/3.x/src/Client.js to adjust the requests that are sent.

The Client is an abstraction over the particular HTTP library. It handles all the HTTP requests / responses and you can use either one of those parameters to adjust the request preflight.

I'm not actively maintaining this repo and all PRs are welcome so if you see something you're not happy with or have questions I'm happy to discuss / merge.