Merge branch 'frontend/timo' into develop

This commit is contained in:
Timo Volkmann 2019-05-14 12:06:59 +02:00
commit 7ccf8fc42e
3 changed files with 96 additions and 67 deletions

View File

@ -199,21 +199,16 @@
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
this.$router.push({path: '/overview'});
}).catch((error) => {
//TODO: Fehlermeldungen
// Error
let msg;
let title;
if (error.response) {
// The request was made and the server responded with a status code
title = "Problem with response!";
msg = error.response;
title = "Bitte Eingaben überprüfen!";
msg = error.response.data;
} else if (error.request) {
// The request was made but no response was received
title = "Problem with request!";
msg = "Error occured due to wrong server request!"
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
title = "Error";
msg = error.message;
console.log('Error', error.message);
@ -227,7 +222,24 @@
console.log("POST api/editCache: " + response.statusText);
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
this.$router.push({path: '/overview'});
})
}).catch((error) => {
let msg;
let title;
if (error.response) {
title = "Bitte Eingaben überprüfen!";
msg = error.response.data;
} else if (error.request) {
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
title = "Error";
msg = error.message;
console.log('Error', error.message);
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
})
}
},
},

View File

@ -109,29 +109,24 @@
localStorage.setItem('userMail', JSON.stringify(data.email));
this.evalAuthentication();
this.$router.push({path: `/overview`})
})
.catch((error) => {
let message;
let header = "Fehler: ";
if (error.response) {
console.log("ERROR RESPONSE");
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
message = error.response.data.error;
header += error.response.status;
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
message = "Anfrage fehlgeschlagen.";
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
message = error.message;
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
}).finally(() => {
}).catch((error) => {
let msg;
let title;
if (error.response) {
title = "Fehler!";
msg = error.response.data;
} else if (error.request) {
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
title = "Error";
msg = error.message;
console.log('Error', error.message);
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
}).finally(() => {
this.loading = false;
this.evalAuthentication();
})

View File

@ -165,26 +165,22 @@
this.initMap();
resolve(true);
}).catch((error) => {
let message;
let header = "Fehler: ";
let msg;
let title;
if (error.response) {
console.log("ERROR RESPONSE");
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
message = error.response.data.error;
header += error.response.status;
title = "Bitte Eingaben überprüfen!";
msg = error.response.data;
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
message = "Anfrage fehlgeschlagen.";
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
title = "Error";
msg = error.message;
console.log('Error', error.message);
message = error.message;
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header,});
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
resolve(true);
})
})
@ -258,26 +254,22 @@
.then((response) => {
this.loadData();
}).catch((error) => {
let message;
let header = "Fehler: ";
let msg;
let title;
if (error.response) {
console.log("ERROR RESPONSE");
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
message = error.response.data.error;
header += error.response.status;
title = "Fehler!";
msg = error.response.data;
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
message = "Anfrage fehlgeschlagen.";
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
title = "Error";
msg = error.message;
console.log('Error', error.message);
message = error.message;
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header,});
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
})
},
startCache(cacheID) {
@ -299,9 +291,24 @@
console.log(response.data);
currentStationID = response.data.aktuelleStation.id;
this.$router.push({path: `/station/${cacheID}/${currentStationID}`});
})
.catch((error) => {
});
}).catch((error) => {
let msg;
let title;
if (error.response) {
title = "Fehler!";
msg = error.response.data;
} else if (error.request) {
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
title = "Error";
msg = error.message;
console.log('Error', error.message);
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
})
}
},
goToReward(cacheID) {
@ -316,9 +323,24 @@
console.log(response.data);
currentStationID = response.data.aktuelleStation.id;
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
})
.catch((error) => {
});
}).catch((error) => {
let msg;
let title;
if (error.response) {
title = "Fehler!";
msg = error.response.data;
} else if (error.request) {
title = "Verbindungsfehler!";
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
console.log(error.request);
} else {
title = "Error";
msg = error.message;
console.log('Error', error.message);
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
})
}
},