vgapp 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,10 @@ class VGFormSender extends BaseModule {
36
36
  super(element, params);
37
37
 
38
38
  this._params = this._getParams(element, mergeDeepObject({
39
- redirect: '',
39
+ redirect: {
40
+ error: '',
41
+ success: ''
42
+ },
40
43
  validate: false,
41
44
  submit: false,
42
45
  fields: [],
@@ -124,15 +127,19 @@ class VGFormSender extends BaseModule {
124
127
 
125
128
  if (_this._params.alert.enabled) {
126
129
  if (typeof status === 'string' && status === 'error') {
127
- _this._alertError(event, data);
130
+ if (_this._params.redirect.error) {
131
+ window.location.href = _this._params.redirect.error;
132
+ } else {
133
+ _this._alertError(event, data);
134
+ }
128
135
  } else if (typeof status === 'string' && status === 'success') {
129
- _this._alertSuccess(event, data);
136
+ if (_this._params.redirect.success) {
137
+ window.location.href = _this._params.redirect.success;
138
+ } else {
139
+ _this._alertSuccess(event, data);
140
+ }
130
141
  }
131
142
  }
132
-
133
- if (_this._params.redirect) {
134
- window.location.href = _this._params.redirect;
135
- }
136
143
  });
137
144
  }
138
145