mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updates for async and await - still
This commit is contained in:
parent
febb36d75f
commit
706c5dc3ef
18 changed files with 220 additions and 233 deletions
|
|
@ -12,20 +12,20 @@ Recipes.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.recipe' (recipeName) {
|
||||
async 'add.recipe' (recipeName) {
|
||||
check(recipeName, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add recipes. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Recipes.insertAsync({
|
||||
return await Recipes.insertAsync({
|
||||
recipeName: recipeName,
|
||||
addedBy: this.userId,
|
||||
addedOn: new Date(),
|
||||
});
|
||||
},
|
||||
'edit.recipe' (recipeId, recipeName) {
|
||||
async 'edit.recipe' (recipeId, recipeName) {
|
||||
check(recipeId, String);
|
||||
check(recipeName, String);
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ Meteor.methods({
|
|||
throw new Meteor.Error('You are not allowed to add recipes. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Recipes.updateAsync({ _id: recipeId }, {
|
||||
return await Recipes.updateAsync({ _id: recipeId }, {
|
||||
$set: {
|
||||
recipeName: recipeName,
|
||||
updatedOn: new Date(),
|
||||
|
|
@ -41,13 +41,13 @@ Meteor.methods({
|
|||
}
|
||||
});
|
||||
},
|
||||
'delete.recipe' (recipeId) {
|
||||
async 'delete.recipe' (recipeId) {
|
||||
check(recipeId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to delete recipes. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Recipes.removeAsync({ _id: recipeId });
|
||||
return await Recipes.removeAsync({ _id: recipeId });
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue