Getting student data - frontend

This commit is contained in:
Tomasz 2021-01-30 21:35:48 +01:00
parent 7cded5d5ba
commit 05c867107a
2 changed files with 35 additions and 11 deletions

View file

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

View file

@ -6,17 +6,6 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'frontend/css/start.css' %}" type="text/css" />
<script src="{% static 'frontend/js/start.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dashboard.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dist/out-grades.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/timetable.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/exams.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/notes.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/attendance.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/homeworks.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dist/out-messages.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/mobile_access.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/school_data.js' %}" type="text/javascript" defer></script>
<link rel="shortcut icon" href="{% static 'frontend/images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
@ -55,6 +44,7 @@
<li><a id="notes_" class='option'><i class="material-icons">emoji_events</i>Uwagi i Osiągnięcia</a></li>
<li><a id="mobile_access_" class='option'><i class="material-icons">devices</i>Dostęp Mobilny</a></li>
<li><a id="school_data_" class='option'><i class="material-icons">business</i>Szkoła i Nauczyciele</a></li>
<li><a id="student_data_" class='option'><i class="material-icons">assignment_ind</i>Dane Ucznia</a></li>
<li><a id="messages_" class="dropdown-trigger" data-target="dropdown1"><i class="material-icons">email</i>Wiadomości</a></li>
<ul id='dropdown1' class='dropdown-content'>
<li><a id='received_' class='option'>Odebrane</a></li>
@ -91,5 +81,17 @@
}
</script>
<script src="{% static 'frontend/js/start.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dashboard.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dist/out-grades.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/timetable.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/exams.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/notes.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/attendance.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/homeworks.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dist/out-messages.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/mobile_access.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/school_data.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/student_data.js' %}" type="text/javascript" defer></script>
</body>
</html>