wulkanowy-web/files/js/grades.js
2021-01-09 20:58:49 +01:00

22 lines
No EOL
684 B
JavaScript

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