From 151949362b0f3d6f60e41237195c41daf1489d0a Mon Sep 17 00:00:00 2001 From: Dunqing Date: Fri, 9 Jun 2023 12:23:53 +0800 Subject: [PATCH] fix: re-insert repeat routes (#2018) --- .../mobile-client/src/server/plugin.ts | 45 ++----------------- .../mobile-client/src/server/routes.ts | 38 ++++++++++++++++ 2 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 packages/plugins/mobile-client/src/server/routes.ts diff --git a/packages/plugins/mobile-client/src/server/plugin.ts b/packages/plugins/mobile-client/src/server/plugin.ts index a5eeb6372..b6e93e2d1 100644 --- a/packages/plugins/mobile-client/src/server/plugin.ts +++ b/packages/plugins/mobile-client/src/server/plugin.ts @@ -1,48 +1,13 @@ import { InstallOptions, Plugin } from '@nocobase/server'; +import { routes } from './routes'; export class MobileClientPlugin extends Plugin { afterAdd() {} - async load() { + async load() {} + + async install() { const repository = this.app.db.getRepository('uiRoutes'); - const routes = [ - { - type: 'route', - path: '/mobile/:name(.+)?', - component: 'MApplication', - uiSchema: { - type: 'void', - 'x-component': 'MContainer', - 'x-designer': 'MContainer.Designer', - 'x-component-props': {}, - properties: { - page: { - type: 'void', - 'x-component': 'MPage', - 'x-designer': 'MPage.Designer', - 'x-component-props': {}, - properties: { - grid: { - type: 'void', - 'x-component': 'Grid', - 'x-initializer': 'MBlockInitializers', - 'x-component-props': { - showDivider: false, - }, - }, - }, - }, - }, - }, - routes: [ - { - type: 'route', - path: '', - component: 'RouteSchemaComponent', - }, - ], - }, - ]; for (const values of routes) { await repository.create({ values, @@ -50,8 +15,6 @@ export class MobileClientPlugin extends Plugin { } } - async install(options?: InstallOptions) {} - async afterEnable() {} async afterDisable() {} diff --git a/packages/plugins/mobile-client/src/server/routes.ts b/packages/plugins/mobile-client/src/server/routes.ts new file mode 100644 index 000000000..3470f1170 --- /dev/null +++ b/packages/plugins/mobile-client/src/server/routes.ts @@ -0,0 +1,38 @@ +export const routes = [ + { + type: 'route', + path: '/mobile/:name(.+)?', + component: 'MApplication', + uiSchema: { + type: 'void', + 'x-component': 'MContainer', + 'x-designer': 'MContainer.Designer', + 'x-component-props': {}, + properties: { + page: { + type: 'void', + 'x-component': 'MPage', + 'x-designer': 'MPage.Designer', + 'x-component-props': {}, + properties: { + grid: { + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'MBlockInitializers', + 'x-component-props': { + showDivider: false, + }, + }, + }, + }, + }, + }, + routes: [ + { + type: 'route', + path: '', + component: 'RouteSchemaComponent', + }, + ], + }, +];