Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Conversation

@scottBowles
Copy link

Currently, queries accept a custom fetch (mainly for SvelteKit's SSR fetch) but mutations use the browser's fetch, since they will always have access to it. This PR will allow the developer to pass a custom fetch to both.

Why?

For those of us using external apis and needing to add an Authorization header to the request. Like the SvelteKit RealWorld example app, I store a jwt in a cookie, receive the cookie in the handle hook, and put the jwt in the session. In order to hit the external api directly with gQuery rather than routing everything through a SvelteKit endpoint, it makes sense to retrieve the token from the session store whenever I need to hit the api. Given access to the fetch function, I can easily wrap fetch and add the token to the Authorization header. But gQuery's current implementation doesn't allow for this on mutations since I have no access to the fetch function being used.

@height
Copy link

height bot commented Apr 13, 2022

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@stolinski
Copy link
Contributor

Good call but I think I have something different in mind to solve this. Will update soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants