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

@ -16,27 +16,27 @@ UserConfig.allow({
});
Meteor.methods({
'add.darkModePref' (pref) {
async 'add.darkModePref' (pref) {
check(pref, String);
if (!this.userId) {
throw new Meteor.Error('Not able to change theme setting. Make sure you are logged in with valid system administrator credentials.');
}
return UserConfig.insertAsync({
return await UserConfig.insertAsync({
user: this.userId,
darkMode: pref,
dateAdded: Date()
});
},
'update.darkModePref' (pref) {
async 'update.darkModePref' (pref) {
check(pref, String);
if (!this.userId) {
throw new Meteor.Error('Not able to change theme setting. Make sure you are logged in with valid system administrator credentials.');
}
return UserConfig.updateAsync({ user: this.userId }, {
return await UserConfig.updateAsync({ user: this.userId }, {
$set: {
darkMode: pref,
dateUpdate: Date()