Skip to content

Commit

Permalink
fix(space-connector): ensure authorization header is set only if toke…
Browse files Browse the repository at this point in the history
…n exists (#5301)

* fix(space-connector): ensure authorization header is set only if token exists

Signed-off-by: Wanjin Noh <[email protected]>

* style: improve code formatting and interface naming consistency

Signed-off-by: Wanjin Noh <[email protected]>

---------

Signed-off-by: Wanjin Noh <[email protected]>
  • Loading branch information
WANZARGEN authored Dec 23, 2024
1 parent 973057a commit b644050
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions apps/web/src/services/asset-inventory/AssetInventoryLSB.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<props>();
const props = defineProps<Props>();
</script>

<template>
<fragment>
<cloud-service-l-s-b v-if="currentMenuId === MENU_ID.CLOUD_SERVICE" />
<metric-explorer-l-s-b v-else-if="currentMenuId === MENU_ID.METRIC_EXPLORER" :width="width"/>
<metric-explorer-l-s-b v-else-if="currentMenuId === MENU_ID.METRIC_EXPLORER"
:width="props.width"
/>
<security-l-s-b v-else-if="currentMenuId === MENU_ID.SECURITY" />
</fragment>
</template>
3 changes: 2 additions & 1 deletion packages/core-lib/src/space-connector/service-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit b644050

Please sign in to comment.