- export const useRouteUtils = () => {
- const route = useRoute()
- const getIdFromRoute = (): number => {
- if (!route.params.id || !/\d+/.test(route.params.id as string)) {
- throw new Error('No id found in route')
- }
- return parseInt(route.params.id as string)
- }
- return { getIdFromRoute }
- }
|