Get Customer Async
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<div id="console-log"></div>
CSS
.console-line {
font-family: monospace;
margin: 2px;
}
JavaScript 1.7
const apiURL = 'https://floating-meadow-81947.herokuapp.com/api'
// Get customer record
async function getCustomerAsync(custId) {
try {
const response = await axios.get(apiURL + '/Customers/' + custId);
console.log(response.data);
} catch (error) {
console.error(error);
}
}
const a = await getCustomerAsync(1);
console.log(a);