mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
14 lines
331 B
TypeScript
14 lines
331 B
TypeScript
import { useCurrentStateAndParams } from '@uirouter/react';
|
|
|
|
export function useTeamIdParam() {
|
|
const {
|
|
params: { id: teamIdParam },
|
|
} = useCurrentStateAndParams();
|
|
const teamId = parseInt(teamIdParam, 10);
|
|
|
|
if (!teamIdParam || Number.isNaN(teamId)) {
|
|
throw new Error('Team ID is missing');
|
|
}
|
|
|
|
return teamId;
|
|
}
|