Merge pull request #1077 from freqtrade/dependabot/npm_and_yarn/main/axios-1.2.2

build(deps): bump axios from 1.2.1 to 1.2.2
This commit is contained in:
Matthias 2023-01-05 10:41:30 +01:00 committed by GitHub
commit 7e7ba655f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 13 deletions

View File

@ -19,7 +19,7 @@
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
"@vuepic/vue-datepicker": "^3.6.4", "@vuepic/vue-datepicker": "^3.6.4",
"@vueuse/core": "^9.10.0", "@vueuse/core": "^9.10.0",
"axios": "^1.2.1", "axios": "^1.2.2",
"bootstrap": "^5.2.3", "bootstrap": "^5.2.3",
"bootstrap-vue-3": "^0.5.0", "bootstrap-vue-3": "^0.5.0",
"bootswatch": "^5.2.3", "bootswatch": "^5.2.3",

View File

@ -1,5 +1,5 @@
import { useBotStore } from '@/stores/ftbotwrapper'; import { useBotStore } from '@/stores/ftbotwrapper';
import axios from 'axios'; import axios, { AxiosHeaders } from 'axios';
import { UserService } from './userService'; import { UserService } from './userService';
export function useApi(userService: UserService, botId: string) { export function useApi(userService: UserService, botId: string) {
@ -10,15 +10,18 @@ export function useApi(userService: UserService, botId: string) {
}); });
// Sent auth headers interceptor // Sent auth headers interceptor
api.interceptors.request.use( api.interceptors.request.use(
(config) => { (request) => {
const custconfig = config;
const token = userService.getAccessToken(); const token = userService.getAccessToken();
// Append token to each request try {
if (token) { if (token) {
// Merge custconfig dicts request.headers = request.headers as AxiosHeaders;
custconfig.headers = { ...config.headers, ...{ Authorization: `Bearer ${token}` } }; // Append token to each request
request.headers.set('Authorization', `Bearer ${token}`);
} }
return custconfig; } catch (e) {
console.log(e);
}
return request;
}, },
(error) => Promise.reject(error), (error) => Promise.reject(error),
); );

View File

@ -1875,10 +1875,10 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
axios@^1.2.1: axios@^1.2.2:
version "1.2.1" version "1.2.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.1.tgz#44cf04a3c9f0c2252ebd85975361c026cb9f864a" resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.2.tgz#72681724c6e6a43a9fea860fc558127dbe32f9f1"
integrity sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A== integrity sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==
dependencies: dependencies:
follow-redirects "^1.15.0" follow-redirects "^1.15.0"
form-data "^4.0.0" form-data "^4.0.0"