19 lines
484 B
JavaScript
19 lines
484 B
JavaScript
|
const update = document.querySelector('#update-button');
|
||
|
|
||
|
update.addEventListener('click', _ => {
|
||
|
fetch('/quotes', {
|
||
|
method: 'put',
|
||
|
headers: { 'Content-Type': 'application/json' },
|
||
|
body: JSON.stringify({
|
||
|
name: 'Marcus',
|
||
|
quotes: 'Ich bin ein Zitat5454!'
|
||
|
})
|
||
|
})
|
||
|
.then(res => {
|
||
|
if (res.ok) return res.json();
|
||
|
})
|
||
|
.then(response => {
|
||
|
window.location.reload(true);
|
||
|
})
|
||
|
|
||
|
})
|