todos-contra-el-fuego-web/imports/api/Users/server/methods.js

32 lines
691 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check';
import editProfile from './edit-profile';
import rateLimit from '../../../modules/rate-limit';
Meteor.methods({
'users.editProfile': function usersEditProfile(profile) {
check(profile, {
emailAddress: String,
profile: {
name: {
first: String,
last: String,
},
},
});
return editProfile({ userId: this.userId, profile })
.then(response => response)
.catch((exception) => {
throw new Meteor.Error('500', exception);
});
},
});
rateLimit({
methods: [
'users.editProfile',
],
limit: 5,
timeRange: 1000,
});