Files
shopdb-flask/shopdb/plugins/templates/frontend/routes.js.tmpl

50 lines
1.7 KiB
Cheetah

/**
* ${Name} plugin routes.
*
* This file lives in the plugin, not in the core frontend tree.
* scripts/stage-frontend.mjs copies plugins/${name}/frontend/ into
* frontend/src/.plugins-staged/${name}/ and aggregates this default export
* into routes.gen.js, which the router spreads in - so no registration edit
* is needed, and pruning the plugin for a lean build removes its frontend
* with it (ADR-013).
*
* Every route carries meta.plugin '${name}' so the ADR-009 guard redirects to
* the dashboard when the ${name} backend plugin is disabled. Form routes add
* requiresAuth so anonymous users cannot reach create or edit.
*
* View imports are relative (./views/...) because they travel with this file.
* Anything from the CORE tree uses the @ alias (@/api, @/components/...),
* which resolves the same before and after staging.
*/
export default [
{
path: '${name}',
name: '${name}',
component: () => import('./views/${Name}List.vue'),
meta: { plugin: '${name}' }
},
{
path: '${name}/new',
name: '${name}-new',
component: () => import('./views/${Name}Form.vue'),
meta: { requiresAuth: true, plugin: '${name}' }
},
{
path: '${name}/:id',
name: '${name}-detail',
component: () => import('./views/${Name}Detail.vue'),
meta: { plugin: '${name}' }
},
{
path: '${name}/:id/edit',
name: '${name}-edit',
component: () => import('./views/${Name}Form.vue'),
meta: { requiresAuth: true, plugin: '${name}' }
}
]
// Full-screen routes that render OUTSIDE AppLayout (kiosk, print pages).
// Declared even when empty so routes.gen.js can read `.toplevel` off the
// module without Rollup warning about a missing export.
export const toplevel = []