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 @@ Stores.allow({
});
Meteor.methods({
'add.store' (storeName) {
async 'add.store' (storeName) {
check(storeName, String);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.');
}
return Stores.insertAsync({
return await Stores.insertAsync({
storeName: storeName,
owner: this.userId,
});
},
'edit.store' (storeId, storeName) {
async 'edit.store' (storeId, storeName) {
check(storeId, String);
check(storeName, String);
@ -32,19 +32,19 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to edit stores. Make sure you are logged in with valid user credentials.');
}
return Stores.updateAsync({ _id: storeId }, {
return await Stores.updateAsync({ _id: storeId }, {
$set: {
storeName: storeName,
}
});
},
'delete.store' (storeId) {
async 'delete.store' (storeId) {
check(storeId, String);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to delete stores. Make sure you are logged in with valid user credentials.');
}
return Stores.removeAsync({ _id: storeId });
return await Stores.removeAsync({ _id: storeId });
},
});