Set the baseURL for ajax requests (#373)

* Set the baseURL for ajax requests

* Use async/await on AJAX calls

* Add mix_public() cache generated asset cache busting

* Move storage container into separate class

* Fix some styling
This commit is contained in:
Nabeel S
2019-08-27 15:08:42 -04:00
committed by GitHub
parent fd2f4f2150
commit 09f3e3cfdf
16 changed files with 335 additions and 145 deletions

View File

@@ -1,18 +1,17 @@
'use strict';
/**
* Lookup an airport from the server
* @param icao
* @param callback
*
* @param {String} icao
*/
export default (icao, callback) => {
export default async (icao) => {
let params = {
method: 'GET',
url: '/api/airports/' + icao + '/lookup',
};
console.log('Looking airport up');
axios(params)
.then(response => {
console.log(response);
callback(response.data);
});
const response = await axios(params);
console.log('lookup raw response: ', response);
return response.data;
};

View File

@@ -1,19 +1,16 @@
/**
* Lookup an airport from the server
* @param fromICAO
* @param toICAO
* @param callback
*
* @param {String} fromICAO
* @param {String} toICAO
*/
export default (fromICAO, toICAO, callback) => {
export default async (fromICAO, toICAO) => {
let params = {
method: 'GET',
url: '/api/airports/' + fromICAO + '/distance/' + toICAO,
};
console.log('Calcuating airport distance');
axios(params)
.then(response => {
console.log(response);
callback(response.data);
});
const response = await axios(params);
console.log('distance raw response: ', response);
return response.data;
};