Refactor all JS API calls #360 (#375)

* Refactor all JS API calls #360

* Remove unused imports

* Lint JS

* Fix doubled api key

* Formatting

* Added extra logging to distance lookup

* Remove the .editorconfig file in distrib

* shell check fixes

* Remove the .editorconfig file in distrib
This commit is contained in:
Nabeel S
2019-08-30 08:08:00 -04:00
committed by GitHub
parent e62e4a865d
commit 0d1f38cf85
39 changed files with 1397 additions and 745 deletions

View File

@@ -1,4 +1,5 @@
'use strict';
import request from '../request';
/**
* Add a bid to a flight
@@ -8,16 +9,16 @@
* @returns {Promise<*>}
*/
export async function addBid(flight_id) {
const params = {
method: 'POST',
url: '/api/user/bids',
data: {
'_method': 'POST',
'flight_id': flight_id
}
};
const params = {
method: 'POST',
url: '/api/user/bids',
data: {
_method: 'POST',
flight_id,
},
};
return axios(params);
return request(params);
}
/**
@@ -28,14 +29,14 @@ export async function addBid(flight_id) {
* @returns {Promise<*>}
*/
export async function removeBid(flight_id) {
const params = {
method: 'POST',
url: '/api/user/bids',
data: {
'_method': 'DELETE',
'flight_id': flight_id
}
};
const params = {
method: 'POST',
url: '/api/user/bids',
data: {
_method: 'DELETE',
flight_id,
},
};
return axios(params);
return request(params);
}