feat: remove unneeded null coalescing assignment

axios headers are now alway present (according to the typings)

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2337>
This commit is contained in:
Kasper Seweryn 2023-01-23 13:09:10 +01:00 committed by Georg Krause
parent 89db3e0f14
commit e1d5c9f832
No known key found for this signature in database
GPG Key ID: 2970D504B2183D22
1 changed files with 2 additions and 3 deletions

View File

@ -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']
}