Updates for async and await - still

This commit is contained in:
Brian McGonagill 2025-07-22 13:50:49 -05:00
parent febb36d75f
commit 706c5dc3ef
18 changed files with 220 additions and 233 deletions

View file

@ -12,19 +12,19 @@ ShopLists.allow({
});
Meteor.methods({
'add.shopList' (shopName) {
async 'add.shopList' (shopName) {
check(shopName, Sring);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to add shopping lists. Make sure you are logged in with valid user credentials.');
}
return ShopLists.insert({
return await ShopLists.insert({
shopName: shopName,
shopOwner: this.userId,
});
},
'edit.shopList' (shopId, shopName) {
async 'edit.shopList' (shopId, shopName) {
check(shopId, String);
check(shopName, String);
@ -32,19 +32,19 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to edit shopping lists. Make sure you are logged in with valid user credentials.');
}
return ShopLists.update({ _id: shopId }, {
return await ShopLists.update({ _id: shopId }, {
$set: {
shopName: shopName,
}
});
},
'delete.shopList' (shopId) {
async 'delete.shopList' (shopId) {
check(shopId, String);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to delete shopping lists. Make sure you are logged in with valid user credentials.');
}
return ShopLists.remove({ _id: shopId });
return await ShopLists.remove({ _id: shopId });
},
});