mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
* Introduced tsconfig.app.json and tsconfig.base.json * yarn.lock * Introduced tsconfig.app.json, tsconfig.base.jsonfig. * Refactored eslint.config.js to latest structure * Returned previous recommended rules. * More rules * Force import rules * Check * Check * Cleanup ESLint configuration and plugins * Cleanup heap: "writable",DD_RUM: "writable" from ESLint configuration * "scripts" moved to the top of package.json
39 lines
910 B
TypeScript
39 lines
910 B
TypeScript
import {
|
|
type UseMutationOptions,
|
|
type UseQueryOptions,
|
|
useMutation,
|
|
useQuery,
|
|
} from "@tanstack/react-query";
|
|
|
|
import apiService from "./apiService";
|
|
import type { ApplicationStatus } from "./interfaces";
|
|
|
|
// Shuts down the Helm Dashboard application
|
|
export function useShutdownHelmDashboard(
|
|
options?: UseMutationOptions<string, Error>
|
|
) {
|
|
return useMutation<string, Error>({
|
|
mutationFn: () =>
|
|
apiService.fetchWithDefaults("/", {
|
|
method: "DELETE",
|
|
}),
|
|
...(options ?? {}),
|
|
});
|
|
}
|
|
|
|
// Gets application status
|
|
export function useGetApplicationStatus(
|
|
options?: UseQueryOptions<ApplicationStatus | null>
|
|
) {
|
|
return useQuery<ApplicationStatus | null>({
|
|
queryKey: ["status"],
|
|
queryFn: async () =>
|
|
await apiService.fetchWithSafeDefaults<ApplicationStatus | null>({
|
|
url: "/status",
|
|
fallback: null,
|
|
}),
|
|
|
|
...(options ?? {}),
|
|
});
|
|
}
|