Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want to stop or fetch/get token values inside hooks #496

Open
code7070 opened this issue Mar 16, 2023 · 1 comment
Open

Want to stop or fetch/get token values inside hooks #496

code7070 opened this issue Mar 16, 2023 · 1 comment

Comments

@code7070
Copy link

I love Ky, especially as an alternative to migrating from axios and apicase

Can I hold or stop or perform certain requests before executing the original request using hooks?

example: if an API get-product is fired, I want to check the token first. If the token doesn't exist I want to make a token request then continue the API request.

@sindresorhus
Copy link
Owner

Hooks are async, so the request will wait for the hooks: https://github.com/sindresorhus/ky#hooksafterresponse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants