requireModelInfo
Overview
Require model info to be loaded before accessing the route.
The route's action is allowed when model info lists it (narrowed by the model config's routeActions) or when it is a workflow transition code the user may take. When the server denies workflow discovery for the model with a 403, the model's CRUD actions still follow model info, and only transition routes are refused. When the server denies model info itself with a 403, the guard shows a "Permission Denied" toast instead of "Model Not Found". The toast only reports the refusal. The server enforces it.
Signature
requireModelInfo(instance, redirectTo, to, router, pinia)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| instance | App | yes | The Vue app instance. |
| redirectTo | string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric | yes | Where to redirect if model info is not found or is denied, the action is not allowed, or the route is a transition and workflow discovery is denied. |
| to | RouteLocationNormalizedLoadedGeneric | yes | The target route. |
| router | Router | yes | The router instance. |
| pinia | Pinia | yes | The Pinia instance. |
Returns
Promise
true when the model exists and the action is allowed, a redirect route when it does not, or false to cancel the navigation because the authenticated user changed while the metadata was being fetched.
Source
client/lib/router/guards.js:325