mirror of https://github.com/portainer/portainer
14 lines
298 B
TypeScript
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;
|
||
|
}
|