From b6440500bc96062945933e23827c12ef2cec35c6 Mon Sep 17 00:00:00 2001 From: WANJIN Date: Mon, 23 Dec 2024 14:40:06 +0900 Subject: [PATCH] fix(space-connector): ensure authorization header is set only if token exists (#5301) * fix(space-connector): ensure authorization header is set only if token exists Signed-off-by: Wanjin Noh * style: improve code formatting and interface naming consistency Signed-off-by: Wanjin Noh --------- Signed-off-by: Wanjin Noh --- .../src/services/asset-inventory/AssetInventoryLSB.vue | 8 +++++--- packages/core-lib/src/space-connector/service-api.ts | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue b/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue index 06c606ba28..0f5ba9ab68 100644 --- a/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue +++ b/apps/web/src/services/asset-inventory/AssetInventoryLSB.vue @@ -8,16 +8,18 @@ import MetricExplorerLSB from '@/services/asset-inventory/components/MetricExplo import SecurityLSB from '@/services/asset-inventory/components/SecurityLSB.vue'; const { currentMenuId } = useCurrentMenuId(); -interface props { +interface Props { width: number; } -const props = defineProps(); +const props = defineProps(); diff --git a/packages/core-lib/src/space-connector/service-api.ts b/packages/core-lib/src/space-connector/service-api.ts index 9dec86c686..349108a978 100644 --- a/packages/core-lib/src/space-connector/service-api.ts +++ b/packages/core-lib/src/space-connector/service-api.ts @@ -52,7 +52,8 @@ export default class ServiceAPI { // Set the access token const auth = request.headers?.Authorization; - if (!auth) request.headers.Authorization = `Bearer ${this.tokenApi.getAccessToken()}`; + const token = this.tokenApi.getAccessToken(); + if (!auth && token) request.headers.Authorization = `Bearer ${token}`; return request; });