hankhank10 / alpine-fetch

Straightforward interactive HTTP requests from within your Alpine.JS markup
GNU General Public License v3.0
71 stars 4 forks source link

how about bind jwt header in request #3

Open ericxin1982 opened 10 months ago

ericxin1982 commented 10 months ago

Hi @hankhank10

Is it possible to add an object for header request info, like jwt?

Thanks Eric Xin

c-nv-s commented 2 weeks ago

@hankhank10 I was directed to this plugin by a different plugin maintainer but this missing feature is a bit of a blocker for me using it. Is there any chance of sharing an expectation of whether this is planned to be included at any point in the future?

edit: for anyone who doesn't mind using an axios wrapper there is this: https://github.com/markmead/alpinejs-axios where you can pass headers

x-data="{
result: null,
api_url: 'https://mysite.com/api/',
api_key: 'secret'}"
x-on:click="result = await $post(api_url, {'hello': 'world', 'another_key': 123}, { headers: {'X-API-Key': api_key}})