Я пытаюсь использовать autoform с метеорным проверенным методом простой схемы и collection2. Однако, когда я ввести значения в текстовых полях я получаю:Использование aldeed: autoform Я получаю доступ отрицательно
undefined error:403
errorType:"Meteor.Error"
message:"Access denied [403]"
reason:"Access denied"
stack:"Error↵ at Connection._livedata_result http://localhost:3000/packages/ddp-client.js`
Моего код использует следующий шаблон:
{{#autoForm collection=club id="insertClubs" type="insert"}}
<fieldset>
<legend>Add a Club</legend>
{{> afQuickField name='name'}}
{{> afQuickField name='number'}}
{{> afQuickField name='updated'}}
{{> afQuickField name='created'}}
</fieldset>
<button type="submit" class="btn btn-primary">Insert</button>
{{/autoForm}}
тогда я использую помощник события, чтобы прослушать представить и вызвать validatedmethod:
submit .btn btn-primary'(event, instance) {
console.log('test');
insert.call({
name: 'test',
number: 3,
updated: new Date(),
created: new Date()
}, (err, res) => {
console.log(err);
});
}
и это сама вставка вызова:
export const insert = new ValidatedMethod({
name: 'Clubs.methods.insert',
validate: Clubs.simpleSchema().validator(),
run(newClub) {
// In here, we can be sure that the newClub argument is
// validated.
console.log('insert new club');
if (!this.userId) {
throw new Meteor.Error('Clubs.methods.insert.not-logged-in',
'Must be logged in to create a club.');
}
Clubs.insert(newClub)
}
});
Я думаю, что эта настройка фактически не вызывает мой метод вставки, поскольку я не вижу консоль.log, но метеорит возвращается с ошибкой. Любая идея, что может быть проблемой?