Getting data

This commit is contained in:
Tomasz 2021-02-07 21:31:37 +01:00
parent f75ad01c35
commit f5592c8bfd
7 changed files with 106 additions and 0 deletions

View file

@ -1,6 +1,23 @@
import React, { Component } from 'react';
class AttendanceCom extends Component {
constructor(props) {
super(props);
var cookies_data = sessionStorage.getItem('cookies_data');
var csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch('../api/attendance', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: JSON.stringify({"cookies": cookies_data, "week": 0})
}).then(response => response.json()).then(data => {
console.log(data);
})
}
render() {
return (
<p>Attendance</p>

View file

@ -1,6 +1,23 @@
import React, { Component } from 'react';
class ExamsCom extends Component {
constructor(props) {
super(props);
var cookies_data = sessionStorage.getItem('cookies_data');
var csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch('../api/exams', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: JSON.stringify({"cookies": cookies_data, "week": 0})
}).then(response => response.json()).then(data => {
console.log(data)
})
}
render() {
return (
<p>Exams</p>

View file

@ -1,6 +1,23 @@
import React, { Component } from 'react';
class HomeworksCom extends Component {
constructor(props) {
super(props);
var cookies_data = sessionStorage.getItem('cookies_data');
var csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch('../api/homeworks', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: JSON.stringify({"cookies": cookies_data, "week": 0})
}).then(response => response.json()).then(data => {
console.log(data);
})
}
render() {
return (
<p>Homeworks</p>

View file

@ -1,6 +1,23 @@
import React, { Component } from 'react';
class NotesCom extends Component {
constructor(props) {
super(props);
var cookies_data = sessionStorage.getItem('cookies_data');
var csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch('../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);
})
}
render() {
return (
<p>Notes</p>

View file

@ -1,6 +1,23 @@
import React, { Component } from 'react';
class SchoolDataCom extends Component {
constructor(props) {
super(props);
var cookies_data = sessionStorage.getItem('cookies_data');
var csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch('../api/school_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);
})
}
render() {
return (
<p>School Data</p>

View file

@ -1,6 +1,10 @@
import React, { Component } from 'react';
class StatsCom extends Component {
constructor(props) {
super(props);
}
render() {
return (
<p>Stats</p>

View file

@ -1,6 +1,23 @@
import React, { Component } from 'react';
class StudentDataCom extends Component {
constructor(props) {
super(props);
var cookies_data = sessionStorage.getItem('cookies_data');
var csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch('../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)
})
}
render() {
return (
<p>Student Data</p>