---
url: "https://vueda.dev/v3/reference/api/js/router/guards/functions/requireModelInfo.md"
title: "requireModelInfo"
---

# 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 |
| --- | --- | --- | --- |
| <span id="param-instance">instance</span> | `App` | yes | The Vue app instance. |
| <span id="param-redirectTo">redirectTo</span> | `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. |
| <span id="param-to">to</span> | `RouteLocationNormalizedLoadedGeneric` | yes | The target route. |
| <span id="param-router">router</span> | `Router` | yes | The router instance. |
| <span id="param-pinia">pinia</span> | `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`
