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:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user