Open kvedantmahajan opened 6 years ago
Stack - React 16.2.0 with webpack 3 npm install checkit
usage -
import Checkit from 'checkit'; import { CheckitRules } from '../../_helpers/checkit/campaign';
Campaign Rules below as defined in '../../_helpers/checkit/campaign';
var CheckitRules = new Checkit({ name: 'required', type: 'required', audience_list_id: 'required' }, { labels: { name: 'name', type: 'type', audience_list_id: 'audience_list_id' } });
var payload = { name: campaign_name || 'test', type: campaign_type || 'regular', audience_list_id: audience_list_id }
CheckitRules.run(payload).then(function(validated) { console.log(validated); }).catch(Checkit.Error, function(err) { console.log(err.toJSON()); });
As soon as I any empty value on payload it doesn't catch error. The success function is working fine if I make sure to populate every value.
This is surprising !
Stack - React 16.2.0 with webpack 3 npm install checkit
usage -
import Checkit from 'checkit'; import { CheckitRules } from '../../_helpers/checkit/campaign';
Campaign Rules below as defined in '../../_helpers/checkit/campaign';
var CheckitRules = new Checkit({ name: 'required', type: 'required', audience_list_id: 'required' }, { labels: { name: 'name', type: 'type', audience_list_id: 'audience_list_id' } });
var payload = { name: campaign_name || 'test', type: campaign_type || 'regular', audience_list_id: audience_list_id }
CheckitRules.run(payload).then(function(validated) { console.log(validated); }).catch(Checkit.Error, function(err) { console.log(err.toJSON()); });
As soon as I any empty value on payload it doesn't catch error. The success function is working fine if I make sure to populate every value.
This is surprising !