@compas/code-gen
Advanced tools
Comparing version
{ | ||
"name": "@compas/code-gen", | ||
"version": "0.0.165", | ||
"version": "0.0.166", | ||
"description": "Generate various boring parts of your server", | ||
@@ -18,4 +18,4 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@compas/cli": "0.0.165", | ||
"@compas/stdlib": "0.0.165" | ||
"@compas/cli": "0.0.166", | ||
"@compas/stdlib": "0.0.166" | ||
}, | ||
@@ -22,0 +22,0 @@ "maintainers": [ |
@@ -83,33 +83,2 @@ import { js } from "./tag/tag.js"; | ||
contents += js` | ||
export function addRequestIdInterceptors(instance | ||
${context.options.useTypescript ? ": AxiosInstance" : ""} | ||
) | ||
{ | ||
let requestId | ||
${ | ||
context.options.useTypescript ? ": string | undefined" : "" | ||
} = undefined; | ||
instance.interceptors.request.use((config) => { | ||
if (requestId) { | ||
config.headers["x-request-id"] = requestId; | ||
} | ||
return config; | ||
}); | ||
instance.interceptors.response.use((response) => { | ||
if (response.headers["x-request-id"]) { | ||
requestId = response.headers["x-request-id"]; | ||
} | ||
return response; | ||
}, (error) => { | ||
if (error.response && error.response.headers["x-request-id"]) { | ||
requestId = error.response.headers["x-request-id"]; | ||
} | ||
return Promise.reject(error); | ||
}); | ||
} | ||
`; | ||
return contents; | ||
@@ -163,4 +132,4 @@ } | ||
[key: string]: any; | ||
}; | ||
}>; | ||
} | ||
}> | ||
@@ -167,0 +136,0 @@ export type UseQueryOptions<Response, Error, TData = Response> = ReactUseQueryOptions<Response, Error, TData> & { cancelToken?: CancelTokenSource }; |
732212
-0.13%18939
-0.15%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated