Skip to content

Commit

Permalink
fix: prevent frontend from crashing when api call fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Badmuts committed Feb 27, 2024
1 parent 8068c19 commit e67605c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions packages/cms/lib/modules/resource-form-widgets/lib/api.js
Expand Up @@ -21,12 +21,19 @@ module.exports = async function(self, options) {
await self.addOrUpdateNotification(item, 'User');
} catch (error) {
console.error(
'something went wrong when update admin confirmation settings to api',
'something went wrong when update user confirmation settings to api',
error.message
);
}
} else {
await self.disableNotificationRuleSet(`User-${item.formName}`);
try {
await self.disableNotificationRuleSet(`User-${item.formName}`);
} catch (error) {
console.error(
'something went wrong when disabling user confirmation settings to api',
error.message
);
}
}

if (item.confirmationEnabledAdmin) {
Expand All @@ -39,7 +46,14 @@ module.exports = async function(self, options) {
);
}
} else {
await self.disableNotificationRuleSet(`Admin-${item.formName}`);
try {
await self.disableNotificationRuleSet(`Admin-${item.formName}`);
} catch (error) {
console.error(
'something went wrong when disabling admin confirmation settings to api',
error.message
);
}
}
}
})
Expand Down

1 comment on commit e67605c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/frontend:fix-broken-notification-ruleset-e67605c

Please sign in to comment.