From 2b6315966b3e27cbe2b1dd90e052293f6f18426a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:39:54 +0000 Subject: [PATCH 1/2] build(deps): bump axios from 1.2.1 to 1.2.2 Bumps [axios](https://github.com/axios/axios) from 1.2.1 to 1.2.2. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.2.1...1.2.2) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 95d82572..7279a962 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@popperjs/core": "^2.11.6", "@vuepic/vue-datepicker": "^3.6.4", "@vueuse/core": "^9.10.0", - "axios": "^1.2.1", + "axios": "^1.2.2", "bootstrap": "^5.2.3", "bootstrap-vue-3": "^0.5.0", "bootswatch": "^5.2.3", diff --git a/yarn.lock b/yarn.lock index 745997ce..ab0ce536 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1875,10 +1875,10 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== -axios@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.1.tgz#44cf04a3c9f0c2252ebd85975361c026cb9f864a" - integrity sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A== +axios@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.2.tgz#72681724c6e6a43a9fea860fc558127dbe32f9f1" + integrity sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q== dependencies: follow-redirects "^1.15.0" form-data "^4.0.0" From 19a479ef2bb0ccf1f645b3c18cb36067537b444c Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Jan 2023 10:26:49 +0100 Subject: [PATCH 2/2] Fix axios error introduced in last updates --- src/shared/apiService.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/shared/apiService.ts b/src/shared/apiService.ts index d2630251..45c61180 100644 --- a/src/shared/apiService.ts +++ b/src/shared/apiService.ts @@ -1,5 +1,5 @@ import { useBotStore } from '@/stores/ftbotwrapper'; -import axios from 'axios'; +import axios, { AxiosHeaders } from 'axios'; import { UserService } from './userService'; export function useApi(userService: UserService, botId: string) { @@ -10,15 +10,18 @@ export function useApi(userService: UserService, botId: string) { }); // Sent auth headers interceptor api.interceptors.request.use( - (config) => { - const custconfig = config; + (request) => { const token = userService.getAccessToken(); - // Append token to each request - if (token) { - // Merge custconfig dicts - custconfig.headers = { ...config.headers, ...{ Authorization: `Bearer ${token}` } }; + try { + if (token) { + request.headers = request.headers as AxiosHeaders; + // Append token to each request + request.headers.set('Authorization', `Bearer ${token}`); + } + } catch (e) { + console.log(e); } - return custconfig; + return request; }, (error) => Promise.reject(error), );