requireRecentAuth
Overview
Require the user to be recently authenticated.
Signature
requireRecentAuth(redirectTo, to, router, pinia)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| redirectTo | string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric | yes | Where to redirect if not recently authenticated. |
| to | RouteLocationNormalizedGeneric | yes | The target route. |
| router | Router | yes | The router instance. |
| pinia | Pinia | yes | The Pinia instance. |
Returns
Promise
The redirect route if needed.
Examples
js
import { requireRecentAuth } from "@vueda/router/guards";
import { createRouter } from "vue-router";
const router = createRouter({
routes: [
{
path: "/:app/:model/setup",
name: "setup-device",
component: () => import('@/views/ViewAuthRequired.vue'),
beforeEnter: (to, from) => requireRecentAuth({ name: "reauthenticate" }, to, router),
},
// other routes
],
});
export default router;Source
client/lib/router/guards.js:144