@polargold/pg-frontend-vue
    Preparing search index...

    Function useRoutePermission

    • Route-level permission guard: reads route.meta.hasAnyPermission / hasAllPermissions / excludeRoles / customRedirectName, checks the initial route on initialize(), and installs a router.beforeEach guard for subsequent navigation.

      Generalizes the copy found in ama-deep/data-sheet-portal (byte-identical between the two) - replaces their direct useAuthUserStore() import and hardcoded ROUTE.PUBLIC_PAGE_NOT_ALLOWED with UseRoutePermissionOptions, and uses this package's own useRouterPush internally for the permission-redirect (same as the source copies did) - see onNavigationError to opt into logging/fallback-navigation if that redirect itself fails. luv-autoq-frontend's copy is not one of the sources here - it was missing the isAuthUserLoaded guard the other two have, which is exactly the drift this consolidation exists to catch. See isAuthUserLoaded in UseRoutePermissionOptions - it's required, not optional, for that reason.

      Parameters

      Returns { initialize: () => Promise<void> }