Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Sms = require('./lib/sms')
const Email = require('./lib/email')
const oauth2Routes = require('./lib/oauth2Routes')
const get = require('lodash.get')
const request = require('request-promise-native')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wold just use the form data override instead of replacing it with axios

const axios = require('axios')
const bugsnag = require('@bugsnag/js')

process.env.DEBUG = process.env.DEBUG || 'envoy*'
Expand Down Expand Up @@ -148,14 +148,12 @@ Platform.prototype.getRouteLink = function (path, queryParams = {}) {
Platform.prototype.eventUpdate = async function (statusSummary, failureReason = null, eventStatus = 'in_progress') {
let eventReportId = this.req.event_report_id || this.req.params.event_report_id
let eventReportUrl = `${this.config.baseUrl}/a/hub/v1/event_reports/${eventReportId}`
return request.put(eventReportUrl, {
json: true,
body: {
status: eventStatus,
status_message: statusSummary,
failure_reason: failureReason
}
const response = await axios.put(eventReportUrl, {
status: eventStatus,
status_message: statusSummary,
failure_reason: failureReason
})
return response.data
}
Platform.prototype.eventComplete = async function (statusMessage) {
return this.eventUpdate(statusMessage, null, 'done')
Expand Down
Loading