acoeur/themes/acoeur/assets/js/choice.js

13 lines
573 B
JavaScript
Raw Normal View History

2022-10-26 23:12:29 +02:00
document.querySelectorAll('body.users .ac_choice input[type=radio]')
.forEach(elt =>
elt.onchange = () => fetch(document.body.dataset.editUrl + '.choice', {
method: 'PUT',
body: new URLSearchParams(new FormData(elt.form))
})
2022-11-23 21:56:39 +01:00
.then(launchNotes)
2022-10-26 23:12:29 +02:00
.then(() => sleep(1))
.then(() => fetch(document.body.dataset.editUrl + '.result'))
.then(response => response.text())
2022-11-16 22:47:33 +01:00
.then(result => window.location.assign('/users/' + window.location.pathname.split('/')[2] + result))
2022-10-26 23:12:29 +02:00
.catch(error => console.error('Error sending answer', error)))