Skip to content

Commit b7836a9

Browse files
abelanger5wsehl
authored andcommitted
fix: use exchange token for getting plans (#3668)
1 parent f7d29f4 commit b7836a9

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

frontend/app/src/lib/api/api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ declare module 'axios' {
1818
// Explicitly identifies which tenant's exchange token should be used.
1919
// When set, the interceptor skips the localStorage fallback.
2020
xTenantId?: string;
21+
// Forces the exchange token interceptor to run even for non-tenant-scoped
22+
// endpoints (e.g. /api/v1/billing/plans).
23+
useExchangeToken?: boolean;
2124
}
2225
// InternalAxiosRequestConfig is what the interceptor receives after Axios
2326
// merges defaults, so the fields must be declared here too.
2427
interface InternalAxiosRequestConfig {
2528
xResources?: string[];
2629
xTenantId?: string;
30+
useExchangeToken?: boolean;
2731
}
2832
}
2933

@@ -110,7 +114,7 @@ export async function exchangeTokenInterceptor(
110114
config: InternalAxiosRequestConfig,
111115
) {
112116
const resources = config.xResources ?? [];
113-
if (!resources.includes('tenant')) {
117+
if (!resources.includes('tenant') && !config.useExchangeToken) {
114118
return config;
115119
}
116120

frontend/app/src/lib/api/queries.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ export const queries = createQueryKeyStore({
4242
subscriptionPlans: () => ({
4343
queryKey: ['subscription-plans:list'],
4444
queryFn: async () =>
45-
(await cloudApi.subscriptionPlansList({ secure: true })).data,
45+
(
46+
await cloudApi.subscriptionPlansList({
47+
secure: true,
48+
useExchangeToken: true,
49+
})
50+
).data,
4651
}),
4752

4853
paymentMethods: (tenant: string) => ({

0 commit comments

Comments
 (0)