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

Initial commit for the fetch-hooks package #45

Merged
merged 1 commit into from
Apr 2, 2024
Merged

Conversation

vierbergenlars
Copy link
Member

fetch-hooks allows inserting hooks around the fetch() function.

This allows composing functionality with small hook functions instead of having one large data fetching function laying around in the codebase where all common functionality is applied

Copy link

sonarqubecloud bot commented Mar 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
1 Accepted issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

* Hook function that can be applied on `fetch()` to return a new, hooked `fetch()` function
*/
export interface FetchHook {
(fetch: Fetch | HookedFetch): HookedFetch;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface has only a call signature, you should use a function type instead.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😏

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we need to extend hooks, more attributes will be added to the interface, so I would prefer to keep it in this format.

@vierbergenlars vierbergenlars merged commit a9fb1b0 into main Apr 2, 2024
3 checks passed
@vierbergenlars vierbergenlars deleted the init-fetch-hooks branch April 2, 2024 12:57
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

Successfully merging this pull request may close these issues.

2 participants