mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-12 13:48:35 +02:00
Upgrades biome to 1.6.1, and updates husky pre-commit hook. Most changes here are making type imports explicit.
33 lines
883 B
TypeScript
33 lines
883 B
TypeScript
import type { SWRConfiguration } from 'swr';
|
|
import { formatApiPath } from 'utils/formatPath';
|
|
import handleErrorResponses from '../httpErrorResponseHandler';
|
|
import { useConditionalSWR } from '../useConditionalSWR/useConditionalSWR';
|
|
|
|
export const useCheckDependenciesExist = (
|
|
project: string,
|
|
options: SWRConfiguration = {},
|
|
) => {
|
|
const path = formatApiPath(`/api/admin/projects/${project}/dependencies`);
|
|
const { data, error } = useConditionalSWR(
|
|
project,
|
|
false,
|
|
path,
|
|
fetcher,
|
|
options,
|
|
);
|
|
|
|
return {
|
|
dependenciesExist: data,
|
|
error,
|
|
loading: !error && !data,
|
|
};
|
|
};
|
|
|
|
const fetcher = async (path: string): Promise<boolean> => {
|
|
const res = await fetch(path).then(
|
|
handleErrorResponses('Dependencies exist check'),
|
|
);
|
|
const data = await res.json();
|
|
return data;
|
|
};
|