mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 14:28:04 +00:00
Enabled recommended-requiring-type-checking as result type fixes provided (#632)
* Enabled recommended-requiring-type-checking * from .cjs to .js * check * check * check * check * A lot of types aligned and refactored * More strict types * Improvement * Improvements * Improvements * Fixed routs * Fixed import types
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from "@tanstack/react-query";
|
||||
import { HelmRepositories } from "./interfaces";
|
||||
import type { HelmRepositories } from "./interfaces";
|
||||
import apiService from "./apiService";
|
||||
|
||||
// Get list of Helm repositories
|
||||
@@ -14,7 +14,11 @@ export function useGetRepositories(
|
||||
return useQuery<HelmRepositories>({
|
||||
queryKey: ["helm", "repositories"],
|
||||
queryFn: () =>
|
||||
apiService.fetchWithDefaults<HelmRepositories>("/api/helm/repositories"),
|
||||
apiService.fetchWithSafeDefaults<HelmRepositories>({
|
||||
url: "/api/helm/repositories",
|
||||
fallback: [],
|
||||
}),
|
||||
select: (data) => data?.sort((a, b) => a?.name?.localeCompare(b?.name)),
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
@@ -22,11 +26,11 @@ export function useGetRepositories(
|
||||
// Update repository from remote
|
||||
export function useUpdateRepo(
|
||||
repo: string,
|
||||
options?: UseMutationOptions<void, unknown, void>
|
||||
options?: UseMutationOptions<string, Error>
|
||||
) {
|
||||
return useMutation<void, unknown, void>({
|
||||
return useMutation<string, Error>({
|
||||
mutationFn: () => {
|
||||
return apiService.fetchWithDefaults<void>(
|
||||
return apiService.fetchWithDefaults<string>(
|
||||
`/api/helm/repositories/${repo}`,
|
||||
{
|
||||
method: "POST",
|
||||
@@ -40,11 +44,11 @@ export function useUpdateRepo(
|
||||
// Remove repository
|
||||
export function useDeleteRepo(
|
||||
repo: string,
|
||||
options?: UseMutationOptions<void, unknown, void>
|
||||
options?: UseMutationOptions<string, Error>
|
||||
) {
|
||||
return useMutation<void, unknown, void>({
|
||||
return useMutation<string, Error>({
|
||||
mutationFn: () => {
|
||||
return apiService.fetchWithDefaults<void>(
|
||||
return apiService.fetchWithDefaults<string>(
|
||||
`/api/helm/repositories/${repo}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
|
||||
Reference in New Issue
Block a user