chore: remove cashed
This commit is contained in:
23
frontend/src/hooks/useDocker.ts
Normal file
23
frontend/src/hooks/useDocker.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { dockerApi } from '../api/docker'
|
||||
|
||||
export function useDocker(host?: string | null) {
|
||||
const {
|
||||
data: containers = [],
|
||||
isLoading,
|
||||
error,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: ['docker-containers', host],
|
||||
queryFn: () => dockerApi.listContainers(host || undefined),
|
||||
enabled: host !== null, // Disable if host is explicitly null
|
||||
retry: 1, // Don't retry too much if docker is not available
|
||||
})
|
||||
|
||||
return {
|
||||
containers,
|
||||
isLoading,
|
||||
error,
|
||||
refetch,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user