Custom client for UTBM UV API calls

This commit is contained in:
imperosol
2025-01-21 13:57:18 +01:00
parent 85c8b7d11c
commit 6d519e3a07
3 changed files with 57 additions and 26 deletions

View File

@ -46,12 +46,7 @@
const codeInput = document.querySelector('input[name="code"]')
autofillBtn.addEventListener('click', () => {
const today = new Date()
let year = today.getFullYear()
if (today.getMonth() < 7) { // student year starts in september
year--
}
const url = `/api/uv/${year}/${codeInput.value}`;
const url = `/api/uv/${codeInput.value}`;
deleteQuickNotifs()
$.ajax({
@ -70,7 +65,7 @@
.filter(([elem, _]) => !!elem) // skip non-existing DOM elements
.forEach(([elem, val]) => { // write the value in the form field
if (elem.tagName === 'TEXTAREA') {
// MD editor text input
// MD editor text input
elem.parentNode.querySelector('.CodeMirror').CodeMirror.setValue(val);
} else {
elem.value = val;