alpine-fetch icon indicating copy to clipboard operation
alpine-fetch copied to clipboard

how about bind jwt header in request

Open ericxin1982 opened this issue 1 year ago • 1 comments

Hi @hankhank10

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

Thanks Eric Xin

ericxin1982 avatar Nov 30 '23 15:11 ericxin1982

@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}})

c-nv-s avatar Sep 23 '24 17:09 c-nv-s