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,5 +1,12 @@
|
||||
|
||||
require('./../bootstrap');
|
||||
|
||||
// Import the bids functionality
|
||||
import {addBid, removeBid} from './bids';
|
||||
window.phpvms.bids = {
|
||||
addBid,
|
||||
removeBid,
|
||||
};
|
||||
|
||||
// Import the mapping function
|
||||
window.phpvms.map = require('../maps/index');
|
||||
|
||||
41
resources/js/frontend/bids.js
Normal file
41
resources/js/frontend/bids.js
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Add a bid to a flight
|
||||
*
|
||||
* @param {String} flight_id
|
||||
*
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addBid(flight_id) {
|
||||
const params = {
|
||||
method: 'POST',
|
||||
url: '/api/user/bids',
|
||||
data: {
|
||||
'_method': 'POST',
|
||||
'flight_id': flight_id
|
||||
}
|
||||
};
|
||||
|
||||
return axios(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a bid from a given flight
|
||||
*
|
||||
* @param {String} 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
|
||||
}
|
||||
};
|
||||
|
||||
return axios(params);
|
||||
}
|
||||
Reference in New Issue
Block a user