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,6 +188,15 @@
|
|||||||
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)
|
||||||
|
|
||||||
|
//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) {
|
if (this.isNewCache) {
|
||||||
console.log("CREATECACHE")
|
console.log("CREATECACHE")
|
||||||
this.$axios.post('/api/createCache', cache)
|
this.$axios.post('/api/createCache', cache)
|
||||||
@ -240,7 +248,16 @@
|
|||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
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