Skip to content

Commit

Permalink
Step 7.2: Add update picture method
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Dotan Simha committed Nov 23, 2016
1 parent ebb8452 commit c50cbe3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/methods.js
Expand Up @@ -77,5 +77,15 @@ Meteor.methods({
Messages.remove({ chatId: chatId });

return Chats.remove({ _id: chatId });
},
updatePicture(data) {
if (!this.userId) {
throw new Meteor.Error('not-logged-in',
'Must be logged in to update his picture.');
}

check(data, String);

return Meteor.users.update(this.userId, { $set: { 'profile.picture': data } });
}
});

0 comments on commit c50cbe3

Please sign in to comment.