Fixed: Incorrect friends list shown

This commit is contained in:
Moon Patel
2023-07-03 16:40:28 +05:30
parent 1d9f2cc65a
commit f7bb1e89cb
4 changed files with 35 additions and 26 deletions
+7 -2
View File
@@ -38,9 +38,14 @@ const userSchema = new Schema(
},
methods: {
async getFriends() {
await this.populate("friends", "username");
await this.populate("friends", "username email");
// console.log(this.friends);
return this.friends.map(friend => friend.username);
return this.friends.map((friend) => {
return {
username: friend.username,
email: friend.email,
};
});
},
},
}