Validation of Rankinglist points
This commit is contained in:
parent
6e08f4e038
commit
42a912701b
@ -103,7 +103,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters} from 'vuex';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Cache",
|
name: "Cache",
|
||||||
@ -189,58 +188,76 @@
|
|||||||
console.log(cache);
|
console.log(cache);
|
||||||
cache.stationen.push(this.computedEndstation);
|
cache.stationen.push(this.computedEndstation);
|
||||||
console.log("isnewcache "+this.isNewCache)
|
console.log("isnewcache "+this.isNewCache)
|
||||||
if (this.isNewCache) {
|
|
||||||
console.log("CREATECACHE")
|
//Error messages
|
||||||
this.$axios.post('/api/createCache', cache)
|
if(!this.validateRankingPoints()){
|
||||||
.then((response) => {
|
let title = "Falsche Formatierung";
|
||||||
console.log("POST api/createCache: " + response.statusText);
|
let msg = "Die Ranglistenpunkte müssen eine ganze Zahl sein";
|
||||||
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||||
this.$router.push({path: '/overview'});
|
}
|
||||||
}).catch((error) => {
|
|
||||||
let msg;
|
if(this.validateEverything()) {
|
||||||
let title;
|
if (this.isNewCache) {
|
||||||
if (error.response) {
|
console.log("CREATECACHE")
|
||||||
title = "Bitte Eingaben überprüfen!";
|
this.$axios.post('/api/createCache', cache)
|
||||||
msg = error.response.data;
|
.then((response) => {
|
||||||
} else if (error.request) {
|
console.log("POST api/createCache: " + response.statusText);
|
||||||
title = "Verbindungsfehler!";
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
this.$router.push({path: '/overview'});
|
||||||
console.log(error.request);
|
}).catch((error) => {
|
||||||
} else {
|
let msg;
|
||||||
title = "Error";
|
let title;
|
||||||
msg = error.message;
|
if (error.response) {
|
||||||
console.log('Error', error.message);
|
title = "Bitte Eingaben überprüfen!";
|
||||||
}
|
msg = error.response.data;
|
||||||
console.log(error.config);
|
} else if (error.request) {
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
title = "Verbindungsfehler!";
|
||||||
})
|
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
||||||
} else {
|
console.log(error.request);
|
||||||
console.log("EDITCACHE")
|
} else {
|
||||||
this.$axios.put('/api/editCache', cache)
|
title = "Error";
|
||||||
.then((response) => {
|
msg = error.message;
|
||||||
console.log("POST api/editCache: " + response.statusText);
|
console.log('Error', error.message);
|
||||||
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
}
|
||||||
this.$router.push({path: '/overview'});
|
console.log(error.config);
|
||||||
}).catch((error) => {
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||||
let msg;
|
})
|
||||||
let title;
|
} else {
|
||||||
if (error.response) {
|
console.log("EDITCACHE")
|
||||||
title = "Bitte Eingaben überprüfen!";
|
this.$axios.put('/api/editCache', cache)
|
||||||
msg = error.response.data;
|
.then((response) => {
|
||||||
} else if (error.request) {
|
console.log("POST api/editCache: " + response.statusText);
|
||||||
title = "Verbindungsfehler!";
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!"
|
this.$router.push({path: '/overview'});
|
||||||
console.log(error.request);
|
}).catch((error) => {
|
||||||
} else {
|
let msg;
|
||||||
title = "Error";
|
let title;
|
||||||
msg = error.message;
|
if (error.response) {
|
||||||
console.log('Error', error.message);
|
title = "Bitte Eingaben überprüfen!";
|
||||||
}
|
msg = error.response.data;
|
||||||
console.log(error.config);
|
} else if (error.request) {
|
||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
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,});
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
validateRankingPoints: function () {
|
||||||
|
var re = new RegExp('^[0-9]+$');
|
||||||
|
var rps = String.valueOf(this.computedCache.rankingPoints);
|
||||||
|
return re.test(rps);
|
||||||
|
},
|
||||||
|
validateEverything(){
|
||||||
|
return this.validateRankingPoints();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
computedCache: {
|
computedCache: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user