Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Reynolds committed Apr 29, 2024
1 parent fef8ce7 commit 0cfa33f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions labapp/app/markdown/lb.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,22 @@ Build an origin pool and load balancer based on the following criteria:
<div id="result1" class="mt-3"></div>
<script>
document.getElementById('requestBtn1').addEventListener('click', async () => {
const button = document.getElementById('requestBtn1');
const resultDiv = document.getElementById('result1');
button.disabled = true;
try {
const response = await axios.get('/_lb1');
if(response.data.status === 'success') {
if (response.data.status === 'success') {
const prettyJson = JSON.stringify(response.data.data, null, 4);
resultDiv.innerHTML = `<pre class="alert alert-success"><b>Success:</b><br><code>${prettyJson}</code></pre>`;
} else {
const errJson = JSON.stringify(response.data.error, null, 4);
resultDiv.innerHTML = `<div class="alert alert-danger"><b>Request Failed:</b>&nbsp;&nbsp;<code>${errJson}</code></div>`;
}
resultDiv.scrollIntoView({ behavior: 'smooth', block: 'end' }); // Smooth scroll to the resultDiv
} catch (error) {
resultDiv.innerHTML = `<div class="alert alert-danger">Error: ${error.message}</div>`;
} finally {
button.disabled = false;
resultDiv.scrollIntoView({ behavior: 'smooth', block: 'end' }); // Smooth scroll to the resultDiv
}
});
Expand Down

0 comments on commit 0cfa33f

Please sign in to comment.