Better error return in subscriptions

This commit is contained in:
vjrj 2018-03-02 10:08:52 +01:00
parent 9062012d18
commit 8deaafb96b
2 changed files with 16 additions and 14 deletions

View file

@ -40,8 +40,10 @@ class SubscriptionEditor extends React.Component {
Meteor.call(methodToCall, doc, (error, subscriptionId) => {
if (error) {
self.setState({ disableFstBtn: false });
if (error.reason && error.reason.reason) {
Bert.alert(t(error.reason.reason), 'danger');
if (error.error && error.error === 'on-already-subscribed') {
Bert.alert(t(error.error), 'danger');
} else if (error.reason) {
Bert.alert(error.reason, 'danger');
}
} else {
self.setState({ disableFstBtn: false });