Add politicians question type
This commit is contained in:
parent
4fe218166f
commit
2893f2bc53
16 changed files with 101 additions and 33 deletions
18
app/javascript/submit_value.js
Normal file
18
app/javascript/submit_value.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import debounce from 'debounce'
|
||||
|
||||
const csrfToken = document.querySelector("[name='csrf-token']").content
|
||||
|
||||
export function submitValue(url, value) {
|
||||
fetch(url, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
"x-csrf-token": csrfToken,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(value),
|
||||
})
|
||||
}
|
||||
|
||||
export function submitValueDebounced() {
|
||||
return debounce(submitValue, 300)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue