Skip to content

Commit

Permalink
Return instead of await requests (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruikshanks authored Mar 10, 2024
1 parent 5eaebbe commit 9a71c55
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const ChargingModuleRequest = require('../charging-module.request.js')
* @returns {Promise<Object>} The result of the request; whether it succeeded and the response or error returned
*/
async function send (customerChangeData) {
const result = await ChargingModuleRequest.post('v3/wrls/customer-changes', customerChangeData)
const path = 'v3/wrls/customer-changes'

return result
return ChargingModuleRequest.post(path, customerChangeData)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/charging-module/create-transaction.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ const ChargingModuleRequest = require('../charging-module.request.js')
*/
async function send (billRunId, transactionData) {
const path = `v3/wrls/bill-runs/${billRunId}/transactions`
const result = await ChargingModuleRequest.post(path, transactionData)

return result
return ChargingModuleRequest.post(path, transactionData)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/charging-module/delete-bill-run.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ const ChargingModuleRequest = require('../charging-module.request.js')
*/
async function send (billRunId) {
const path = `v3/wrls/bill-runs/${billRunId}`
const result = await ChargingModuleRequest.delete(path)

return result
return ChargingModuleRequest.delete(path)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/charging-module/generate-bill-run.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ const ChargingModuleRequest = require('../charging-module.request.js')
*/
async function send (billRunId) {
const path = `v3/wrls/bill-runs/${billRunId}/generate`
const result = await ChargingModuleRequest.patch(path)

return result
return ChargingModuleRequest.patch(path)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/charging-module/reissue-bill.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ const ChargingModuleRequest = require('../charging-module.request.js')
*/
async function send (billRunId, billId) {
const path = `v3/wrls/bill-runs/${billRunId}/invoices/${billId}/rebill`
const result = await ChargingModuleRequest.patch(path)

return result
return ChargingModuleRequest.patch(path)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/charging-module/view-bill-run-status.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ const ChargingModuleRequest = require('../charging-module.request.js')
*/
async function send (billRunId) {
const path = `v3/wrls/bill-runs/${billRunId}/status`
const result = await ChargingModuleRequest.get(path)

return result
return ChargingModuleRequest.get(path)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/charging-module/view-bill.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ const ChargingModuleRequest = require('../charging-module.request.js')
*/
async function send (billRunId, billId) {
const path = `v3/wrls/bill-runs/${billRunId}/invoices/${billId}`
const result = await ChargingModuleRequest.get(path)

return result
return ChargingModuleRequest.get(path)
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions app/requests/legacy/refresh-bill-run.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ const LegacyRequest = require('../legacy.request.js')
*/
async function send (billRunId) {
const path = `billing/batches/${billRunId}/refresh`
const result = await LegacyRequest.post('water', path)

return result
return LegacyRequest.post('water', path)
}

module.exports = {
Expand Down

0 comments on commit 9a71c55

Please sign in to comment.