1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

refactor(gitops): migrate git form to react [EE-4849] (#8268)

This commit is contained in:
Chaim Lev-Ari 2023-02-23 01:43:33 +05:30 committed by GitHub
parent afe6cd6df0
commit 273a3f9a10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
130 changed files with 3194 additions and 1190 deletions

View file

@ -1,13 +1,19 @@
import { useCurrentStateAndParams } from '@uirouter/react';
export function useEnvironmentId() {
import { EnvironmentId } from '@/react/portainer/environments/types';
export function useEnvironmentId(force = true): EnvironmentId {
const {
params: { endpointId: environmentId },
} = useCurrentStateAndParams();
if (!environmentId) {
if (!force) {
return 0;
}
throw new Error('endpointId url param is required');
}
return environmentId;
return parseInt(environmentId, 10);
}