We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
request.hook(request, options)
1 parent 8f176a5 commit 54d78b9Copy full SHA for 54d78b9
src/with-defaults.ts
@@ -25,9 +25,18 @@ export default function withDefaults(
25
return fetchWrapper(endpoint.parse(endpointOptions));
26
}
27
28
- return endpointOptions.request.hook((options: Defaults) => {
29
- return fetchWrapper(endpoint.parse(options));
30
- }, endpointOptions);
+ const request = (route: Route | Endpoint, parameters?: Parameters) => {
+ return fetchWrapper(
+ endpoint.parse(endpoint.merge(<Route>route, parameters))
31
+ );
32
+ };
33
+
34
+ Object.assign(request, {
35
+ endpoint,
36
+ defaults: withDefaults.bind(null, endpoint)
37
+ });
38
39
+ return endpointOptions.request.hook(request, endpointOptions);
40
};
41
42
return Object.assign(newApi, {
0 commit comments