use existing api instead of creating a new plugin

This commit is contained in:
Iuri Matias 2018-10-15 21:54:32 -04:00 committed by Pascal Precht
parent d1a7960cbe
commit 2453d686eb
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 2 additions and 2 deletions

View File

@ -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})
}); });