You've already forked AstralRinth
forked from didirus/AstralRinth
Migrate to Turborepo (#1251)
This commit is contained in:
10
apps/frontend/src/composables/route-params.js
Normal file
10
apps/frontend/src/composables/route-params.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Extracts the [id] from the route params and returns it as a ref.
|
||||
*
|
||||
* @param {string?} key The key of the route param to extract.
|
||||
* @returns {import('vue').Ref<string | string[] | undefined>}
|
||||
*/
|
||||
export const useRouteId = (key = 'id') => {
|
||||
const route = useNativeRoute()
|
||||
return route.params?.[key] || undefined
|
||||
}
|
||||
Reference in New Issue
Block a user