fix user info update logic

This commit is contained in:
syuilo 2021-01-03 15:04:08 +09:00
parent e8b2ff4d62
commit e6706df8f9

View file

@ -59,7 +59,8 @@ export default class Friend {
this.doc = inserted;
} else {
this.doc = exist;
this.doc.user = opts.user;
this.doc.user = { ...this.doc.user, ...opts.user };
console.log(this.doc.user);
this.save();
}
} else if (opts.doc) {
@ -70,8 +71,11 @@ export default class Friend {
}
@autobind
public updateUser(user: User) {
this.doc.user = user;
public updateUser(user: Partial<User>) {
this.doc.user = {
...this.doc.user,
...user,
};
this.save();
}