use existing api instead of creating a new plugin
This commit is contained in:
parent
d1a7960cbe
commit
2453d686eb
|
@ -2,6 +2,7 @@ let utils = require('../../utils/utils');
|
||||||
|
|
||||||
class Suggestions {
|
class Suggestions {
|
||||||
constructor(embark, options) {
|
constructor(embark, options) {
|
||||||
|
this.embark = embark;
|
||||||
this.events = embark.events;
|
this.events = embark.events;
|
||||||
this.plugins = options.plugins;
|
this.plugins = options.plugins;
|
||||||
this.registerApi();
|
this.registerApi();
|
||||||
|
@ -10,8 +11,7 @@ class Suggestions {
|
||||||
}
|
}
|
||||||
|
|
||||||
registerApi() {
|
registerApi() {
|
||||||
let plugin = this.plugins.createPlugin('consoleApi', {});
|
this.embark.registerAPICall('post', '/embark-api/suggestions', (req, res) => {
|
||||||
plugin.registerAPICall('post', '/embark-api/suggestions', (req, res) => {
|
|
||||||
let suggestions = this.getSuggestions(req.body.command)
|
let suggestions = this.getSuggestions(req.body.command)
|
||||||
res.send({result: suggestions})
|
res.send({result: suggestions})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue