display usb-butter section if the usb-butter directory yields 200
This commit is contained in:
parent
fbcf287319
commit
f3362f56f0
4 changed files with 29 additions and 0 deletions
|
|
@ -32,3 +32,15 @@ const btnModal = document.querySelector('.btn-modal');
|
|||
btnModal.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// If #usb-butter exists and a request to thishost.tld/usb-butter returns status 200
|
||||
// change display of #usb-butter to inherit
|
||||
const usbButter = document.querySelector('#usb-butter');
|
||||
if (usbButter) {
|
||||
fetch('/usb-butter')
|
||||
.then(response => {
|
||||
if (response.status === 200) {
|
||||
usbButter.style.display = 'inherit';
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue