While filtering data from the store, I need to check whether 'name' field of the data is 'stackoverflow'. So I use:
data() {
myname: 'stackoverflow'
},
computed: {
user() {
return this.$store.getters['entities/users/query']().where('name', myname).first();
}
}
It works perfectly if the name is given as 'stackoverflow', but not for 'StackOverflow'. Can the 'where' clause be modified so that it checks case insensitive?
I have never used the vuex-orm but i think this should work, according to the docs
https://vuex-orm.github.io/vuex-orm/guide/store/retrieving-data.html#simple-where-clauses
computed: {
user() {
return this.$store.getters['entities/users/query']().where(user => user.name.toUpperCase() === this.myname.toUpperCase()).first();
}
}
Or even
computed: {
user() {
return this.$store.getters['entities/users/query']().where('name', value => value.toUpperCase() === this.myname.toUpperCase()).first();
}
}