tachybase_todo/packages/plugin-export/src/server.ts

29 lines
869 B
TypeScript
Raw Normal View History

2021-08-13 09:57:21 +08:00
import Resourcer from '@nocobase/resourcer';
import _export from './actions/export';
export const ACTION_NAME_EXPORT = 'export';
export default async function (options = {}) {
const resourcer: Resourcer = this.resourcer;
resourcer.registerActionHandler(ACTION_NAME_EXPORT, _export);
2021-09-11 18:53:26 +08:00
// // TODO(temp): 继承 list 权限的临时写法
// resourcer.use(async (ctx, next) => {
// if (ctx.action.params.actionName === ACTION_NAME_EXPORT) {
// ctx.action.mergeParams({
// actionName: 'list'
// });
2021-08-13 09:57:21 +08:00
2021-09-11 18:53:26 +08:00
// console.log('action name in export has been rewritten to:', ctx.action.params.actionName);
2021-08-13 09:57:21 +08:00
2021-09-11 18:53:26 +08:00
// const permissionPlugin = ctx.app.getPluginInstance('@nocobase/plugin-permissions');
// if (permissionPlugin) {
// return permissionPlugin.middleware(ctx, next);
// }
// }
2021-08-13 09:57:21 +08:00
2021-09-11 18:53:26 +08:00
// await next();
// });
2021-08-13 09:57:21 +08:00
}