wulkanowy-web/files/js/notes.js
2021-01-09 23:41:40 +01:00

22 lines
No EOL
677 B
JavaScript

const notes_ = document.querySelector('#notes_');
myStorage = window.sessionStorage;
const getNotes = () => {
document.querySelector('#content').innerHTML = 'Here is notes (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/notes', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(response => response.json()).then(data => {
console.log(data);
})
}
notes_.addEventListener('click', getNotes);