I am trying to update the users' password that I have retrieved previously when an event is published to the PasswordUpdated
Channel. This is what I have tried so far,
this.apollo.subscribe({
query: this.passwordUpdatedSubscription
}).subscribe(({passwordUpdated}:any) => {
this.userDataQuery.updateQuery((previousResult) => {
previousResult.getUsers.filter(user => user.name === passwordUpdated.name).forEach(user => user.password = passwordUpdated.password);
});
});
However, I just found out from the error in the console that previousResult
is immutable. When I tried to update the password in previousResult
, the property has writable: false
. How can I resolve this?