Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokeni #795

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions reactapp/src/ALPHA/EditStudentForma.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ class Forma extends Component {
}

componentDidMount(){
//http://localhost:31901/api/korisnik/getAllStudents
axios.get ('https://si2019alpha.herokuapp.com/api/korisnik/getAllStudents')
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.get ('https://si2019alpha.herokuapp.com/api/korisnik/getAllStudents?currentUsername=' + currentUsername + '&token=' + token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({lista: response.data});
Expand Down Expand Up @@ -65,12 +70,19 @@ class Forma extends Component {
const body1=JSON.stringify(body);
console.log("Body1: ", body1);

xhr.open('POST','https://si2019alpha.herokuapp.com/api/korisnik/updateStudent', true);
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhr.open('POST','https://si2019alpha.herokuapp.com/api/korisnik/updateStudent?currentUsername=' + currentUsername + '&token=' + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
const resp = xhr.responseText;
alert(resp);
// alert(resp);
alert("Uspješno izvršene izmjene!");
}
}
xhr.onerror = () => {
Expand All @@ -83,9 +95,17 @@ class Forma extends Component {

promote(id){
const json={id};
axios.post("https://si2019alpha.herokuapp.com/api/korisnik/promoteStudentToAssistant", json)

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.post("https://si2019alpha.herokuapp.com/api/korisnik/promoteStudentToAssistant?currentUsername=" + currentUsername + "&token=" + token, json)
.then(response=>{
console.log(response);
alert("Student uspješno unaprijeđen u asistenta!");
})
.catch(error=>{
console.log(error)
Expand Down
10 changes: 8 additions & 2 deletions reactapp/src/ALPHA/Forma.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ class Forma extends Component {
"website":null,
"titula":null
}
const body = JSON.stringify(json);

const body = JSON.stringify(json);
console.log(body);

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

//http://localhost:31901/api/korisnik/AddNewStudent
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/AddNewStudent', true);
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/AddNewStudent?currentUsername=' + currentUsername + '&token=' + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
Expand Down
16 changes: 14 additions & 2 deletions reactapp/src/ALPHA/FormaAsistent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ class FormaAsistent extends Component {
}

componentDidMount(){
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.get ('https://si2019alpha.herokuapp.com/api/odsjek/GetOdsjeci')
axios.get ('https://si2019alpha.herokuapp.com/api/odsjek/GetOdsjeci?currentUsername=' + currentUsername + '&token=' + token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({lista: response.data});
Expand Down Expand Up @@ -90,7 +95,14 @@ class FormaAsistent extends Component {
const xhr = new XMLHttpRequest();

const body1 = JSON.stringify(body);
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/AddNewAssistant', true);

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/AddNewAssistant?currentUsername=' + currentUsername + '&token=' + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
Expand Down
19 changes: 16 additions & 3 deletions reactapp/src/ALPHA/FormaAsistentPred.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ class FormaProfPred extends Component {
}

componentDidMount(){
axios.get ('https://si2019alpha.herokuapp.com/api/korisnik/getAllAssistants')
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.get ('https://si2019alpha.herokuapp.com/api/korisnik/getAllAssistants?currentUsername=' + currentUsername + '&token=' + token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({listaAsistenata: response.data});
Expand All @@ -25,7 +31,7 @@ class FormaProfPred extends Component {
console.log(error)
})

axios.get ('https://si2019alpha.herokuapp.com/api/predmet/GetPredmeti')
axios.get ('https://si2019alpha.herokuapp.com/api/predmet/GetPredmeti?currentUsername=' + currentUsername + '&token=' + token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({listaPredmeta: response.data});
Expand All @@ -52,7 +58,14 @@ class FormaProfPred extends Component {
spoji(asistent, predmet){
console.log(asistent,predmet);
const json={"idAsistent":asistent, "idPredmet":predmet}
axios.post("https://si2019alpha.herokuapp.com/api/povezivanje/linkAssistantSubject", json)

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.post("https://si2019alpha.herokuapp.com/api/povezivanje/linkAssistantSubject?currentUsername=" + currentUsername + "&token=" + token, json)
.then(response => {
console.log(response);
})
Expand Down
9 changes: 5 additions & 4 deletions reactapp/src/ALPHA/FormaOdsjek.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ class FormaOdsjek extends Component {

const body = JSON.stringify(data);

var token = window.localStorage.getItem("token");
var currentUsername = window.localStorage.getItem("username");

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);
console.log(currentUsername);

//Drugi URL
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/odsjek/AddNewOdsjek?currentUsername=' + currentUsername + '&token=' + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
Expand Down
2 changes: 0 additions & 2 deletions reactapp/src/ALPHA/FormaOdsjekPred.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class FormaOdsjekPred extends Component {
<select className="form-control" name="predmet" value={predmet} onChange={this.handleInputChange} > </select>
<br />



<input type="submit" value="Dodaj" className="btn btn-success btn-block" />
</form>
</div>
Expand Down
16 changes: 14 additions & 2 deletions reactapp/src/ALPHA/FormaPr.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ class FormaPr extends Component {
this.state = this.initialState
}
componentDidMount(){
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.get ('https://si2019alpha.herokuapp.com/api/odsjek/GetOdsjeci')
axios.get ('https://si2019alpha.herokuapp.com/api/odsjek/GetOdsjeci?currentUsername=' + currentUsername + '&token=' +token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({lista: response.data});
Expand Down Expand Up @@ -84,7 +89,14 @@ class FormaPr extends Component {
};
const body = JSON.stringify(body1);
console.log("Svi potrebni podaci strng: ", body);
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/AddNewProfessor', true);

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/AddNewProfessor?currentUsername=' + currentUsername + '&token=' + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
Expand Down
9 changes: 8 additions & 1 deletion reactapp/src/ALPHA/FormaPredmet.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ class FormaPredmet extends Component {
const xhr = new XMLHttpRequest();

const body = JSON.stringify(data);
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/predmet/AddNewPredmet', true);

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/predmet/AddNewPredmet?currentUsername=' + currentUsername + '&token=' + token,true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
Expand Down
10 changes: 8 additions & 2 deletions reactapp/src/ALPHA/FormaPrikazProf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class prikazAsistenta extends Component{
componentDidMount(param){
var xhttp = new XMLHttpRequest();
var self = this;

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhttp.onreadystatechange = function(){
if (xhttp.readyState == 4 && xhttp.status == 200){
Expand All @@ -25,8 +31,8 @@ class prikazAsistenta extends Component{
}
}

if(param!='') xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/searchProfessor?ime="+param, true);
else xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/getAllProfessors", true);
if(param!='') xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/searchProfessor?ime="+param + '&currentUsername=' + currentUsername + '&token=' + token, true);
else xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/getAllProfessors?currentUsername=" + currentUsername + "&token=" + token, true);

xhttp.send();
}
Expand Down
10 changes: 8 additions & 2 deletions reactapp/src/ALPHA/FormaPrikazStud.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class prikazAsistenta extends Component{
componentDidMount(param){
var xhttp = new XMLHttpRequest();
var self = this;

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhttp.onreadystatechange = function(){
if (xhttp.readyState == 4 && xhttp.status == 200){
Expand All @@ -28,8 +34,8 @@ class prikazAsistenta extends Component{
//"http://localhost:31901/api/korisnik/searchStudent?ime="+param
//"http://localhost:31901/api/korisnik/getAllStudents"

if(param!='') xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/searchStudent?ime="+param, true);
else xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/getAllStudents", true);
if(param!='') xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/searchStudent?ime="+param + '&currentUsername=' + currentUsername + '&token=' + token, true);
else xhttp.open("get", "https://si2019alpha.herokuapp.com/api/korisnik/getAllStudents?currentUsername=" + currentUsername + "&token=" + token, true);

xhttp.send();
}
Expand Down
18 changes: 15 additions & 3 deletions reactapp/src/ALPHA/FormaUpis.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ class FormaUpis extends Component {

componentDidMount(param){
console.log(param);

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

//"http://localhost:31901/api/korisnik/searchStudent?ime="+param
axios.get ("https://si2019alpha.herokuapp.com/api/korisnik/searchStudent?ime="+param)
axios.get ("https://si2019alpha.herokuapp.com/api/korisnik/searchStudent?ime="+param + "&currentUsername" + currentUsername + "&token=" + token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({lista: response.data});
Expand Down Expand Up @@ -69,8 +75,14 @@ class FormaUpis extends Component {
const body = JSON.stringify(json);

console.log(body);
//NOVI API CE BITI
xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/enrollStudentToSemester', true);

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhr.open('POST', 'https://si2019alpha.herokuapp.com/api/korisnik/enrollStudentToSemester?currentUsername=' + currentUsername + '&token=' + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
Expand Down
25 changes: 22 additions & 3 deletions reactapp/src/ALPHA/FormaUrediAsistenta.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ class Forma extends Component {
}

componentDidMount(){
axios.get ('https://si2019alpha.herokuapp.com/api/korisnik/getAllAssistants')
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.get ('https://si2019alpha.herokuapp.com/api/korisnik/getAllAssistants?currentUsername=' + currentUsername + '&token=' + token)
.then(response => {
console.log("Lista: ", response.data);
this.setState({lista: response.data});
Expand Down Expand Up @@ -71,7 +77,13 @@ class Forma extends Component {
const body1=JSON.stringify(body);
console.log("Body1: ", body1);

xhr.open('POST','https://si2019alpha.herokuapp.com/api/korisnik/updateAssistant', true);
var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

xhr.open('POST','https://si2019alpha.herokuapp.com/api/korisnik/updateAssistant?currentUsername=' + currentUsername + "&token=" + token, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = () => {
if(xhr.status === 200) {
Expand All @@ -88,7 +100,14 @@ class Forma extends Component {

promote(id){
const json={id};
axios.post('https://si2019alpha.herokuapp.com/api/korisnik/promoteAssistantToProfessor', json)

var token1 = window.localStorage.getItem("token");
var token = encodeURI(token1);
var currentUsername = window.localStorage.getItem("username");
console.log(token);
console.log(currentUsername);

axios.post('https://si2019alpha.herokuapp.com/api/korisnik/promoteAssistantToProfessor?currentUsername=' + currentUsername + "&token=" + token, json)
.then(response=>{
console.log(response);
})
Expand Down
Loading