portainer/app/react/hooks/useEnvironmentId.ts

14 lines
298 B
TypeScript

import { useCurrentStateAndParams } from '@uirouter/react';
export function useEnvironmentId() {
const {
params: { endpointId: environmentId },
} = useCurrentStateAndParams();
if (!environmentId) {
throw new Error('endpointId url param is required');
}
return environmentId;
}