mirror of https://github.com/portainer/portainer
22 lines
632 B
TypeScript
22 lines
632 B
TypeScript
|
import { useQuery } from 'react-query';
|
||
|
|
||
|
import { withError } from '@/react-tools/react-query';
|
||
|
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||
|
|
||
|
import { getPVCsForCluster } from './service';
|
||
|
|
||
|
// useQuery to get a list of all applications from an array of namespaces
|
||
|
export function usePVCsForCluster(
|
||
|
environemtId: EnvironmentId,
|
||
|
namespaces?: string[]
|
||
|
) {
|
||
|
return useQuery(
|
||
|
['environments', environemtId, 'kubernetes', 'pvcs'],
|
||
|
() => namespaces && getPVCsForCluster(environemtId, namespaces),
|
||
|
{
|
||
|
...withError('Unable to retrieve applications'),
|
||
|
enabled: !!namespaces,
|
||
|
}
|
||
|
);
|
||
|
}
|