Add flag to persist builds
Some checks failed
Some checks failed
This commit is contained in:
23
scripts/form.js
Normal file
23
scripts/form.js
Normal file
@@ -0,0 +1,23 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
for (let btn of document.getElementsByClassName('copybtn')) {
|
||||
btn.addEventListener('click', e => {
|
||||
navigator.clipboard.writeText(e.target.previousElementSibling.innerText);
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('persistChk')?.addEventListener('change', async e => {
|
||||
const sqid = document.getElementById('sqid').textContent;
|
||||
const persist = !!e.target?.checked;
|
||||
const resp = await fetch(`/build/${sqid}/persist`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ persist })
|
||||
});
|
||||
if (!resp.ok) {
|
||||
this.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user