diff --git a/client/package-lock.json b/client/package-lock.json index 57da30e..3d03658 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -17,7 +17,7 @@ "@types/jest": "^26.0.24", "@types/lodash": "^4.14.178", "@types/marked": "^4.0.1", - "axios": "^0.21.4", + "axios": "1.6.0", "core-js": "^3.20.1", "csv-stringify": "^6.0.5", "firebase": "^10.7.1", @@ -6197,8 +6197,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/at-least-node": { "version": "1.0.0", @@ -6267,11 +6266,13 @@ } }, "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dependencies": { - "follow-redirects": "^1.14.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/babel-core": { @@ -7460,7 +7461,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -8501,7 +8501,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -11002,7 +11001,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -15523,7 +15521,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, "engines": { "node": ">= 0.6" } @@ -15532,7 +15529,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "dependencies": { "mime-db": "1.52.0" }, @@ -17665,6 +17661,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", diff --git a/client/package.json b/client/package.json index 75eb9af..caa27d4 100644 --- a/client/package.json +++ b/client/package.json @@ -27,7 +27,7 @@ "@types/jest": "^26.0.24", "@types/lodash": "^4.14.178", "@types/marked": "^4.0.1", - "axios": "^0.21.4", + "axios": "1.6.0", "core-js": "^3.20.1", "csv-stringify": "^6.0.5", "firebase": "^10.7.1", diff --git a/client/src/store/index.ts b/client/src/store/index.ts index 0128321..465ad9f 100644 --- a/client/src/store/index.ts +++ b/client/src/store/index.ts @@ -1,5 +1,5 @@ import {SingleFXConversion, SingleFXConverter} from '../lib/fx' -import axios, {AxiosRequestConfig} from 'axios' +import axios, {AxiosRequestConfig, InternalAxiosRequestConfig} from 'axios' import { AccountDTO, AllState, AssetDTO, @@ -85,16 +85,17 @@ export const storeKey: InjectionKey> = Symbol('vuex-key') export default store(function (/* { ssrContext } */) { - let requestPreprocessor = async (config:AxiosRequestConfig):Promise => { + let requestPreprocessor = async (config:InternalAxiosRequestConfig):Promise => { return config; } - - axios.interceptors.request.use(function (config) { - return requestPreprocessor(config); - }, function (error) { - // Do something with request error - return Promise.reject(error); - }); + axios.interceptors.request.use( + config => { + return requestPreprocessor(config) + }, + error => { + return Promise.reject(error); + } + ); axios.interceptors.response.use(res => res, function (error) { if (error.response.status === 401) { @@ -334,9 +335,7 @@ export default store(function (/* { ssrContext } */) { requestPreprocessor = async (config) => { const token = await getToken(); - config.headers.common = { - Authorization: `Bearer ${token}` // send the access token through the 'Authorization' header - }; + config.headers['Authorization'] = `Bearer ${token}`; return config; }