mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
added client test for the same message
This commit is contained in:
@@ -67,6 +67,20 @@
|
||||
this.$refs.menu.updateOpened();
|
||||
this.$refs.menu.updateActiveName();
|
||||
})
|
||||
},
|
||||
isEquale(message,prop){
|
||||
if(typeof (this.$store.state[prop]) == "object"){
|
||||
for(var i = this.$store.state[prop].length; i--;) {
|
||||
if(this.$store.state[prop][i] !== message[prop][i]){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else{
|
||||
if(this.$store.state[prop] != message[prop]){
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -86,9 +100,14 @@
|
||||
let message = JSON.parse(data.data);
|
||||
for (var prop in message){
|
||||
if(message.hasOwnProperty(prop)){
|
||||
this.$store.state[prop] = message[prop];
|
||||
if(!this.isEquale(message,prop)){
|
||||
this.$store.state[prop] = message[prop];
|
||||
console.log(message);
|
||||
} else{
|
||||
console.log("data is the same");
|
||||
}
|
||||
}
|
||||
console.log(data.data);
|
||||
|
||||
}
|
||||
}
|
||||
catch{
|
||||
|
||||
Reference in New Issue
Block a user