removed doubled function ; return object instead of array with one element
This commit is contained in:
@@ -33,7 +33,7 @@ module.exports = {
|
|||||||
|
|
||||||
updateIntentsJSON: function () {
|
updateIntentsJSON: function () {
|
||||||
databaseHelper
|
databaseHelper
|
||||||
.loadSkill (config.SKILL_DB_ID)
|
.getSkill (config.SKILL_DB_ID)
|
||||||
.then (skill => {
|
.then (skill => {
|
||||||
skill.intents.map (intent => {
|
skill.intents.map (intent => {
|
||||||
alexaApp.intent (
|
alexaApp.intent (
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadSkill: function (skillDbID) {
|
getSkill: function (skillDbID) {
|
||||||
return new Promise ((resolve, reject) => {
|
return new Promise ((resolve, reject) => {
|
||||||
db
|
db
|
||||||
.collection ('skill_list')
|
.collection ('skill_list')
|
||||||
@@ -92,20 +92,5 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
getSkill: function (id) {
|
|
||||||
return new Promise ((resolve, reject) => {
|
|
||||||
db
|
|
||||||
.collection ('skill_list')
|
|
||||||
.find ({_id: ObjectID (id)})
|
|
||||||
.toArray ((err, result) => {
|
|
||||||
if (err) {
|
|
||||||
reject (err);
|
|
||||||
}else{
|
|
||||||
resolve (result);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,11 +31,10 @@ class App extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSkill(this.state._id).then(l=>l.json()).then(result=>{
|
getSkill(this.state._id).then(l=>l.json()).then(result=>{
|
||||||
let jResult = result[0];
|
if (result===undefined) return;
|
||||||
if (jResult===undefined) return;
|
this.setState({ skillID:result.skillID,skillName:result.skillName, invocationName: result.invocationName,
|
||||||
this.setState({ skillID:jResult.skillID,skillName:jResult.skillName, invocationName: jResult.invocationName,
|
invocationAnswer: result.invocationAnswer,
|
||||||
invocationAnswer: jResult.invocationAnswer,
|
allIntents: result.intents, contactEmail: result.contactEmail})
|
||||||
allIntents: jResult.intents, contactEmail: jResult.contactEmail})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.handleIntentClick = this.handleIntentClick.bind(this);
|
this.handleIntentClick = this.handleIntentClick.bind(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user