Skip to content

Commit

Permalink
feat: upgraded axios (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Dec 26, 2023
2 parents 13d4b0f + dad5f08 commit 02c9290
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 74 deletions.
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"ajv-formats": "^2.1.1",
"ajv-keywords": "^5.1.0",
"async-mutex": "^0.4.0",
"axios": "1.4.0",
"axios": "1.6.2",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.0",
"class-transformer": "^0.5.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/queue-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@impler/dal": "^0.12.1",
"@impler/shared": "^0.12.1",
"axios": "^0.26.1",
"axios": "1.6.2",
"dotenv": "^16.0.2",
"envalid": "^7.3.1"
},
Expand Down
21 changes: 21 additions & 0 deletions apps/widget/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,26 @@ module.exports = {
'@hooks': path.resolve(__dirname, './src/hooks'),
'@amplitude': path.resolve(__dirname, './src/util/amplitude/index.ts'),
},
configure: (config) => {
const fileLoaderRule = getFileLoaderRule(config.module.rules);
if (!fileLoaderRule) {
throw new Error('File loader not found');
}
fileLoaderRule.exclude.push(/\.cjs$/);
return config;
},
},
};

function getFileLoaderRule(rules) {
for (const rule of rules) {
if ('oneOf' in rule) {
const found = getFileLoaderRule(rule.oneOf);
if (found) {
return found;
}
} else if (rule.test === undefined && rule.type === 'asset/resource') {
return rule;
}
}
}
2 changes: 1 addition & 1 deletion apps/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@storybook/addon-essentials": "^6.5.13",
"@storybook/react": "^6.5.13",
"@tanstack/react-query": "^4.14.5",
"axios": "^0.26.1",
"axios": "1.6.2",
"bootstrap": "4.6.0",
"cross-env": "^7.0.3",
"file-saver": "^2.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@aws-sdk/client-s3": "^3.185.0",
"@aws-sdk/lib-storage": "^3.360.0",
"@aws-sdk/s3-request-presigner": "^3.276.0",
"axios": "^0.26.1"
"axios": "1.6.2"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": ["prettier --ignore-path .eslintignore --write"],
Expand Down
9 changes: 7 additions & 2 deletions libs/shared/src/services/http-client/api.client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosInstance, AxiosRequestHeaders } from 'axios';
import axios, { AxiosInstance } from 'axios';
import { ACCESS_KEY_NAME } from '../../config';

export interface IParamObject {
Expand Down Expand Up @@ -32,7 +32,12 @@ export class HttpClient {
return this.callWrapper(this.axiosClient.get.bind(this, url, { params }));
}

async post(url: string, body = {}, headers: AxiosRequestHeaders = {}, responseType?: XMLHttpRequestResponseType) {
async post(
url: string,
body = {},
headers: Record<string, string | number> = {},
responseType?: XMLHttpRequestResponseType
) {
return this.callWrapper(this.axiosClient.post.bind(this, url, body, { headers, responseType }));
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"dependencies": {
"@impler/shared": "^0.12.1",
"axios": "^0.26.1"
"axios": "1.6.2"
},
"engines": {
"node": ">=10"
Expand Down
95 changes: 28 additions & 67 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 02c9290

Please sign in to comment.