Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Client {
- constructor(cod, user, pass) {
- this.cod = cod;
- this.user = user;
- this.pass = pass;
- this.apiKey = 'ax6542sdru3217t4eesd9';
- this.getSchede = this.getSchede.bind(this);
- }
- login() {
- return fetch('https://www.portaleargo.it/famiglia/api/rest/login', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-user-id": this.user,
- "x-pwd": this.pass,
- })
- })
- .then(response => response.json())
- .then(data => this.token = data.token);
- }
- getSchede() {
- return fetch('https://www.portaleargo.it/famiglia/api/rest/schede', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-auth-token": this.token,
- "x-key-app": this.apiKey,
- })
- })
- .then(response => response.json())
- .then(data => this.schedaAlunno = data);
- }
- getVoti() {
- return fetch('https://www.portaleargo.it/famiglia/api/rest/votigiornalieri', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-auth-token": this.token,
- "x-key-app": this.apiKey,
- "x-prg-scuola": this.schedaAlunno[0].prgScuola,
- "x-prg-scheda": this.schedaAlunno[0].prgScheda,
- "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
- })
- })
- .then(response => response.json())
- .then(data => this.voti = data)
- }
- getAssenze(){
- return fetch('https://www.portaleargo.it/famiglia/api/rest/assenze', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-auth-token": this.token,
- "x-key-app": this.apiKey,
- "x-prg-scuola": this.schedaAlunno[0].prgScuola,
- "x-prg-scheda": this.schedaAlunno[0].prgScheda,
- "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
- })
- })
- .then(response => response.json())
- .then(data => this.assenze = data)
- }
- getOggiaScuola(){
- return fetch('https://www.portaleargo.it/famiglia/api/rest/oggi', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-auth-token": this.token,
- "x-key-app": this.apiKey,
- "x-prg-scuola": this.schedaAlunno[0].prgScuola,
- "x-prg-scheda": this.schedaAlunno[0].prgScheda,
- "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
- })
- })
- .then(response => response.json())
- .then(data => this.oggiaScuola = data)
- }
- getOrario(){
- return fetch('https://www.portaleargo.it/famiglia/api/rest/orario', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-auth-token": this.token,
- "x-key-app": this.apiKey,
- "x-prg-scuola": this.schedaAlunno[0].prgScuola,
- "x-prg-scheda": this.schedaAlunno[0].prgScheda,
- "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
- })
- })
- .then(response => response.json())
- .then(data => this.orario = data)
- }
- getVotiScrutionio(){
- return fetch('https://www.portaleargo.it/famiglia/api/rest/votiscrutionio', {
- headers: new Headers({
- "x-cod-min": this.cod,
- "x-auth-token": this.token,
- "x-key-app": this.apiKey,
- "x-prg-scuola": this.schedaAlunno[0].prgScuola,
- "x-prg-scheda": this.schedaAlunno[0].prgScheda,
- "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
- })
- })
- .then(response => response.json())
- .then(data => this.votiScrutionio = data)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement