# useNavigationPath

The navigation path information is automatically determined based on the path in the $route object.

For example the url /customers/123-456/addresses/789-123/countries/456-789 would now automatically generate the above information for you!

The Page component automatically calls setupNavigationPath when isNavigationPathEnabled-prop is enabled (default is true)

Use this in a page-route. You can also generate until a specific entity. For example /customers/:customerId/users/:userId/addresses/:addressId

<template>
  <Page :is-navigation-path-enabled="false" />
</template>

<script>
import { onMounted } from '@vue/composition-api'
import { useNavigationPath, useContext } from '@jdi/vue-backoffice-library'

export default {
  setup(_, context) {
    const { store, route } = useContext(context)
    const { setupNavigationPath } = useNavigationPath(store.value, route, 'customers')

    onMounted(() => {
      // In this case, the `routeData` only is generated for `customers`-entity
      setupNavigationPath()
    })
  }
}
</script>