mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
12 lines
283 B
TypeScript
12 lines
283 B
TypeScript
|
import { useOptionalPathParam } from './useOptionalPathParam';
|
||
|
|
||
|
export const useRequiredPathParam = (key: string): string => {
|
||
|
const value = useOptionalPathParam(key);
|
||
|
|
||
|
if (!value) {
|
||
|
throw new Error(`Missing required path param: ${key}`);
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
};
|