Validation of Rankinglist points

This commit is contained in:
Maximilian Leopold 2019-05-29 14:15:25 +02:00
parent 6e08f4e038
commit 42a912701b

View File

@ -103,7 +103,6 @@
</template>
<script>
import {mapGetters} from 'vuex';
export default {
name: "Cache",
@ -189,6 +188,15 @@
console.log(cache);
cache.stationen.push(this.computedEndstation);
console.log("isnewcache "+this.isNewCache)
//Error messages
if(!this.validateRankingPoints()){
let title = "Falsche Formatierung";
let msg = "Die Ranglistenpunkte müssen eine ganze Zahl sein";
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
}
if(this.validateEverything()) {
if (this.isNewCache) {
console.log("CREATECACHE")
this.$axios.post('/api/createCache', cache)
@ -240,7 +248,16 @@
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: {
computedCache: {