Skip to content

Commit 05e1a53

Browse files
committed
Pass organizationId when loading plans
1 parent 72bfae4 commit 05e1a53

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/features/cluster/queries/getPlanTypesQuery.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import { apiClient } from '@/config/apiClient';
22
import { queryKeys } from '@/react-query/constants';
33
import { queryOptions } from '@tanstack/react-query';
44

5-
const getPlanTypes = async () => {
6-
const { data } = await apiClient.get(`/Plan/`);
5+
async function getPlanTypes(organizationId: string) {
6+
const { data } = await apiClient.get(`/Plan/`, {
7+
params: {
8+
organizationId,
9+
},
10+
});
711
return data;
8-
};
12+
}
913

10-
function getPlanTypesOptions() {
14+
export function getPlanTypesOptions(organizationId: string) {
1115
return queryOptions({
12-
queryKey: [queryKeys.cluster, 'instancePlan'],
13-
queryFn: getPlanTypes,
16+
queryKey: [queryKeys.organization, organizationId, 'instancePlan'],
17+
queryFn: () => getPlanTypes(organizationId),
1418
retry: false,
1519
});
1620
}
17-
18-
export { getPlanTypesOptions };

src/features/clusters/upsert/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function UpsertCluster() {
3030

3131
const { data: cluster } = useQuery(getClusterInfoQueryOptions(clusterId));
3232
const { data: organization } = useQuery(getOrganizationQueryOptions(organizationId));
33-
const { data: planTypes } = useQuery(getPlanTypesOptions());
33+
const { data: planTypes } = useQuery(getPlanTypesOptions(organizationId));
3434
const { data: regionLocations } = useQuery(getRegionLocationsOptions(limitRegionParameters));
3535

3636
const deploymentToPerformanceToPlan = useMemo<Record<string, Record<string, SchemaPlan>>>(() =>

0 commit comments

Comments
 (0)