File tree Expand file tree Collapse file tree
adminforth/documentation/docs/tutorial/09-Plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,20 +175,27 @@ export const admin = new AdminForth({
175175
176176### 4. Configure Plugin
177177
178- Attach the plugin to one of your resources, usually the users resource :
178+ Register the plugin in the application's ` globalPlugins ` array :
179179
180- ``` ts title="./resources/adminuser .ts"
180+ ``` ts title="./globalPlugins .ts"
181181import DashboardPlugin from ' @adminforth/dashboard' ;
182182
183- export default {
183+ export const globalPlugins = [
184+ new DashboardPlugin ({
185+ dashboardConfigsResourceId: ' dashboard_configs' ,
186+ }),
187+ ];
188+ ```
189+
190+ Then pass it to the AdminForth configuration:
191+
192+ ``` ts title="./index.ts"
193+ import { globalPlugins } from ' ./globalPlugins.js' ;
194+
195+ export const admin = new AdminForth ({
184196 // ...
185- plugins: [
186- // ...
187- new DashboardPlugin ({
188- dashboardConfigsResourceId: ' dashboard_configs' ,
189- }),
190- ],
191- } as AdminForthResourceInput ;
197+ globalPlugins ,
198+ });
192199```
193200
194201After ` admin.discoverDatabases() ` runs, the plugin creates a default dashboard config if the table is empty:
You can’t perform that action at this time.
0 commit comments