wulkanowy-web/files/js/notes.js

22 lines
677 B
JavaScript
Raw Normal View History

2021-01-09 20:58:49 +01:00
const notes_ = document.querySelector('#notes_');
2021-01-09 23:41:40 +01:00
myStorage = window.sessionStorage;
2021-01-09 20:58:49 +01:00
const getNotes = () => {
document.querySelector('#content').innerHTML = 'Here is notes (in my imagination)';
2021-01-09 23:41:40 +01:00
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);
})
2021-01-09 20:58:49 +01:00
}
notes_.addEventListener('click', getNotes);