Skip to content

Commit 31ba4c2

Browse files
committed
chore: update template axios
1 parent fe5ba14 commit 31ba4c2

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<a href="https://github.com/hunghg255/swagger-typescript-api-es/graphs/contributors" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/all_contributors-1-orange.svg" alt="Contributors" /></a>
1616
<a href="https://github.com/hunghg255/swagger-typescript-api-es/blob/main/LICENSE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/hunghg255/swagger-typescript-api-es" alt="License" /></a>
1717
</p>
18-
1
18+
1919
## 📝 License
2020

2121
Licensed under the [MIT License](https://github.com/hunghg255/swagger-typescript-api-es/blob/master/LICENSE).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-typescript-api-es",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.mjs",

templates/base/http-clients/axios-http-client.ejs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequest
2828
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
2929
secure?: boolean;
3030
format?: ResponseType;
31+
32+
instance?: AxiosInstance;
33+
injectHeaders?: (data: any) => any;
3134
}
3235

3336
export enum ContentType {
@@ -37,11 +40,6 @@ export enum ContentType {
3740
Text = "text/plain",
3841
}
3942

40-
interface IHttpClient {
41-
instance?: AxiosInstance;
42-
injectHeaders: (data: any) => any;
43-
}
44-
4543
export class HttpClient<SecurityDataType = unknown> {
4644
public instance: AxiosInstance;
4745
private securityData: SecurityDataType | null = null;
@@ -50,7 +48,7 @@ export class HttpClient<SecurityDataType = unknown> {
5048
private format?: ResponseType;
5149
private injectHeaders?: (data: any) => any;
5250

53-
constructor({ securityWorker, secure, format, instance, injectHeaders, ...axiosConfig }: ApiConfig<SecurityDataType | IHttpClient> = {}) {
51+
constructor({ securityWorker, secure, format, instance, injectHeaders, ...axiosConfig }: ApiConfig<SecurityDataType> = {}) {
5452
this.instance = instance ?? axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "<%~ apiConfig.baseUrl %>" })
5553
this.secure = secure;
5654
this.format = format;

0 commit comments

Comments
 (0)