From e1d5c9f83263d9264abceb21f9fdbc23de6050e5 Mon Sep 17 00:00:00 2001 From: Kasper Seweryn Date: Mon, 23 Jan 2023 13:09:10 +0100 Subject: [PATCH] feat: remove unneeded null coalescing assignment axios headers are now alway present (according to the typings) Part-of: --- front/src/init/axios.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/front/src/init/axios.ts b/front/src/init/axios.ts index 8d457903e..c46a7b0df 100644 --- a/front/src/init/axios.ts +++ b/front/src/init/axios.ts @@ -9,6 +9,7 @@ import moment from 'moment' import axios from 'axios' import useLogger from '~/composables/useLogger' +import { getDepOptimizationConfig } from 'vite' const { t } = i18n.global const logger = useLogger() @@ -18,8 +19,7 @@ export const install: InitModule = ({ store, router }) => { axios.defaults.xsrfHeaderName = 'X-CSRFToken' axios.interceptors.request.use(function (config) { // Do something before request is sent - if (store.state.auth.oauth.accessToken) { - config.headers ??= {} + if (store.state.auth.oauth.accesscToken) { config.headers.Authorization = store.getters['auth/header'] } return config @@ -133,7 +133,6 @@ export const install: InitModule = ({ store, router }) => { } if (failedRequest.response) { - failedRequest.response.config.headers ??= {} failedRequest.response.config.headers.Authorization = store.getters['auth/header'] }