From 99cad43a5275f89c6fac230bf1f8ab865c7c329c Mon Sep 17 00:00:00 2001 From: Rizky Luthfianto Date: Mon, 31 Dec 2018 17:34:14 +0700 Subject: [PATCH] Fix get latest revision (#101) --- components/bots/bot.ts | 7 +++++-- components/bots/deployment.ts | 7 +++++-- lib/components/bots/bot.js | 2 +- lib/components/bots/deployment.js | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/components/bots/bot.ts b/components/bots/bot.ts index 6541984..bd53d28 100644 --- a/components/bots/bot.ts +++ b/components/bots/bot.ts @@ -189,8 +189,11 @@ export default class Bot extends Component { // get bot latestRevision // TODO: find a better way to get the latest bot revision try { - const { response: {body: data} } = await this.helper.toPromise(this.api.botApi, - this.api.botApi.projectsProjectIdBotGet, projectId); + const { response: { body: data } } = await this.helper.toPromise( + this.api.projectApi, + this.api.projectApi.projectsProjectIdBotGet, projectId + ); + if (data.revision) { latestBotRevision = data.revision; } diff --git a/components/bots/deployment.ts b/components/bots/deployment.ts index 4e404c1..11bcd77 100644 --- a/components/bots/deployment.ts +++ b/components/bots/deployment.ts @@ -19,8 +19,11 @@ export default class Deployment { let cmsRevision: string; try { - const { response: {body: data} } = await this.helper.toPromise(this.api.botApi, - this.api.botApi.projectsProjectIdBotGet, projectId); + const { response: { body: data } } = await this.helper.toPromise( + this.api.projectApi, + this.api.projectApi.projectsProjectIdBotGet, projectId + ); + if (data.revision) { botRevision = data.revision; } diff --git a/lib/components/bots/bot.js b/lib/components/bots/bot.js index 01e24f7..451e830 100644 --- a/lib/components/bots/bot.js +++ b/lib/components/bots/bot.js @@ -188,7 +188,7 @@ class Bot extends merapi_1.Component { // get bot latestRevision // TODO: find a better way to get the latest bot revision try { - const { response: { body: data } } = yield this.helper.toPromise(this.api.botApi, this.api.botApi.projectsProjectIdBotGet, projectId); + const { response: { body: data } } = yield this.helper.toPromise(this.api.projectApi, this.api.projectApi.projectsProjectIdBotGet, projectId); if (data.revision) { latestBotRevision = data.revision; } diff --git a/lib/components/bots/deployment.js b/lib/components/bots/deployment.js index 3471637..6ce7cbb 100644 --- a/lib/components/bots/deployment.js +++ b/lib/components/bots/deployment.js @@ -23,7 +23,7 @@ class Deployment { let nluRevision; let cmsRevision; try { - const { response: { body: data } } = yield this.helper.toPromise(this.api.botApi, this.api.botApi.projectsProjectIdBotGet, projectId); + const { response: { body: data } } = yield this.helper.toPromise(this.api.projectApi, this.api.projectApi.projectsProjectIdBotGet, projectId); if (data.revision) { botRevision = data.revision; }