Skip to content
Snippets Groups Projects
Commit 108ee83d authored by chris's avatar chris
Browse files

use addRule for new rules

parent 44dd19ea
No related branches found
No related tags found
1 merge request!45Develop
......@@ -8,12 +8,15 @@ import {
@injectable()
class Rules {
config = {};
name = "";
constructor(@inject("Config") config, schema) {
this.rules = config.rules;
constructor(schema, plugins) {
console.log("rules?", schema, plugins);
this.PmPlugins = plugins;
this.schema = schema;
return inputRules(this.allRules(this.rules));
}
addRule(rules) {
console.log(rules);
// return inputRules(this.allRules(rules));
}
allRules(rules = []) {
......
......@@ -6,12 +6,14 @@ export default class RulesService extends Service {
register() {
const { schema } = this.container.get("config").options;
const configRules = this.config[0];
const PmPlugins = this.app.PmPlugins;
this.container
.bind("Rules")
.toFactory(() => new Rules(schema, PmPlugins).inSingletonScope());
this.container.bind("Rules").toFactory(context => {
const rules = new Rules(this.config[0], schema);
this.app.PmPlugins.add("rules", rules);
});
const rules = this.container.get("Rules");
this.container.get("Rules");
rules.addRule(configRules);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment