mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 06:18:04 +00:00
Fixed queries, mutations and JSON parse (#626)
* Fixed queries ond mutations * Fixed JSON.parse in analytics
This commit is contained in:
@@ -5,11 +5,11 @@ import apiService from "./apiService";
|
||||
|
||||
// Get list of kubectl contexts configured locally
|
||||
function useGetKubectlContexts(options?: UseQueryOptions<KubectlContexts>) {
|
||||
return useQuery<KubectlContexts>(
|
||||
["k8s", "contexts"],
|
||||
() => apiService.fetchWithDefaults<KubectlContexts>("/api/k8s/contexts"),
|
||||
options
|
||||
);
|
||||
return useQuery<KubectlContexts>({
|
||||
queryKey:["k8s", "contexts"],
|
||||
queryFn:() => apiService.fetchWithDefaults<KubectlContexts>("/api/k8s/contexts"),
|
||||
...(options ?? {})
|
||||
});
|
||||
}
|
||||
|
||||
// Get resources information
|
||||
@@ -19,13 +19,13 @@ function useGetK8sResource(
|
||||
namespace: string,
|
||||
options?: UseQueryOptions<K8sResource>
|
||||
) {
|
||||
return useQuery<K8sResource>(
|
||||
["k8s", kind, "get", name, namespace],
|
||||
() =>
|
||||
return useQuery<K8sResource>({
|
||||
queryKey: ["k8s", kind, "get", name, namespace],
|
||||
queryFn:() =>
|
||||
apiService.fetchWithDefaults<K8sResource>(
|
||||
`/api/k8s/${kind}/get?name=${name}&namespace=${namespace}`
|
||||
),
|
||||
options
|
||||
...(options ?? {})}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ function useGetK8sResourceList(
|
||||
kind: string,
|
||||
options?: UseQueryOptions<K8sResourceList>
|
||||
) {
|
||||
return useQuery<K8sResourceList>(
|
||||
["k8s", kind, "list"],
|
||||
() =>
|
||||
return useQuery<K8sResourceList>({
|
||||
queryKey: ["k8s", kind, "list"],
|
||||
queryFn:() =>
|
||||
apiService.fetchWithDefaults<K8sResourceList>(`/api/k8s/${kind}/list`),
|
||||
options
|
||||
...(options ?? {})}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ function useGetK8sResourceDescribe(
|
||||
namespace: string,
|
||||
options?: UseQueryOptions<string>
|
||||
) {
|
||||
return useQuery<string>(
|
||||
["k8s", kind, "describe", name, namespace],
|
||||
() =>
|
||||
return useQuery<string>({
|
||||
queryKey:["k8s", kind, "describe", name, namespace],
|
||||
queryFn:() =>
|
||||
apiService.fetchWithDefaults<string>(
|
||||
`/api/k8s/${kind}/describe?name=${name}&namespace=${namespace}`,
|
||||
{
|
||||
@@ -60,6 +60,6 @@ function useGetK8sResourceDescribe(
|
||||
},
|
||||
}
|
||||
),
|
||||
options
|
||||
...(options ?? {})}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user