Skip to content

Commit

Permalink
feat: remove token function
Browse files Browse the repository at this point in the history
  • Loading branch information
mbadr2200 committed Dec 16, 2022
1 parent f8fd5eb commit f01122f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,16 @@ UserSchema.pre('save', function (next) {
}
});

UserSchema.methods.removeToken = function (token) {

var user = this;
return user.update({
$pull:{
tokens:{token}
}
});

};

var User = mongoose.model('user',UserSchema);

Expand Down

0 comments on commit f01122f

Please sign in to comment.