Skip to content

Commit

Permalink
Gestione pulsanti stato ordini
Browse files Browse the repository at this point in the history
  • Loading branch information
ikros98 committed Jan 6, 2020
1 parent a24c49f commit 0c593c0
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions src/DataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,34 @@ class DataProvider {
window.location.href = "RestOrder";
}

getRestReservation(order) {
sessionStorage.setItem("id", order);
window.location.href = "RestReservation";
}

getRestReservationOrder() {
const data = {
token: this.token,
ordine: {
id: sessionStorage.getItem("id")
}
};
return new Promise((resolve, reject) => {
this.doPost("ristorante/ordini/prenotazione/details", data)
.then(response => {
if (response != null) {
resolve(response);
} else {
reject("NoResult");
}
})
.catch(error => {
console.error(error);
reject("FailedToFetch");
});
});
}

getRestBookedOrder() {
const data = {
token: this.token,
Expand Down Expand Up @@ -444,7 +472,10 @@ class DataProvider {
.then(response => {
if (response != null) {
resolve(response);
window.location.href = "RestOrder";
if(sessionStorage.getItem("tipo"))
window.location.href = "RestOrder";
else
window.location.href = "RestReservation";
} else {
reject("NoResult");
}
Expand All @@ -469,8 +500,10 @@ class DataProvider {
.then(response => {
if (response != null) {
resolve(response);
//window.location.href = "RestOrder";
console.log(response.value);
if(sessionStorage.getItem("tipo"))
window.location.href = "RestOrder";
else
window.location.href = "RestReservation";
} else {
reject("NoResult");
}
Expand Down Expand Up @@ -522,7 +555,10 @@ class DataProvider {
.then(response => {
if (response != null) {
resolve(response);
window.location.href = "RestOrder";
if(sessionStorage.getItem("tipo"))
window.location.href = "RestOrder";
else
window.location.href = "RestReservation";
} else {
reject("NoResult");
}
Expand Down

0 comments on commit 0c593c0

Please sign in to comment.