mirror of
https://github.com/syuilo/ai.git
synced 2024-11-09 15:38:00 +00:00
fix user info update logic
This commit is contained in:
parent
e8b2ff4d62
commit
e6706df8f9
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue