refactor(admin): split protect guards into dedicated export path
- remove `protectAdmin`/`isAdmin` re-exports from `features/admin/index.js` to avoid top-level `next/headers` import - add `./features/admin/protect` export entry in `package.json` - lazy-import `next/headers` in `router.js` `requireAuth` to defer resolution - update `features/admin/README.md` to document new import paths - translate `features/auth/index.js` comment to French for consistency
This commit is contained in:
@@ -10,7 +10,7 @@ Ce répertoire fournit l'interface d'administration complète : layout, navigati
|
||||
|
||||
```
|
||||
src/features/admin/
|
||||
├── index.js protectAdmin, isAdmin, buildNavigationSections, registre
|
||||
├── index.js buildNavigationSections, registre (Next.js-free)
|
||||
├── protect.js gardes d'accès
|
||||
├── navigation.js buildNavigationSections, buildBottomNavItems
|
||||
├── registry.js registre runtime d'extensions
|
||||
@@ -50,7 +50,11 @@ src/features/admin/
|
||||
## Import
|
||||
|
||||
```js
|
||||
import { protectAdmin, isAdmin, buildNavigationSections } from '@zen/core/features/admin';
|
||||
// Gardes RSC — chemin dédié (next/navigation + next/headers, non compatible turbopackIgnore)
|
||||
import { protectAdmin, isAdmin } from '@zen/core/features/admin/protect';
|
||||
|
||||
// Registre et navigation — compatible modules externes
|
||||
import { buildNavigationSections } from '@zen/core/features/admin';
|
||||
import {
|
||||
registerWidget,
|
||||
registerWidgetFetcher,
|
||||
|
||||
Reference in New Issue
Block a user