fix: re-insert repeat routes (#2018)

This commit is contained in:
Dunqing 2023-06-09 12:23:53 +08:00 committed by GitHub
parent 9a376e4116
commit 151949362b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 41 deletions

View File

@ -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() {}

View File

@ -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',
},
],
},
];