educoreapp2 1.0.36 → 1.0.38

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.
package/dist/Tools.js CHANGED
@@ -91,7 +91,7 @@ class Tools {
91
91
  static LSDel(key) {
92
92
  localStorage.removeItem(key);
93
93
  }
94
- static alert(mess) {
94
+ static alert(mess, type) {
95
95
  alert(mess);
96
96
  }
97
97
  static LSSet(key, val) {
@@ -20,6 +20,7 @@ class BaseForm extends _react.Component {
20
20
  this.handle2();
21
21
  });
22
22
  this.props = props;
23
+ this.extraButt = props.extraButt;
23
24
  this.className = !_educoreapp.Tools.empty(props.className) ? props.className : "row";
24
25
  this.module = props.module;
25
26
  this.act = props.act;
@@ -62,6 +63,21 @@ class BaseForm extends _react.Component {
62
63
  }
63
64
  return res;
64
65
  }
66
+ async setErrorBadLoginOrPasswd() {
67
+ for (let k in this.objs) {
68
+ let el = this.objs[k];
69
+ el.setError('BAD_LOGIN_OR_PASSWORD');
70
+ }
71
+ }
72
+ async setError(ee) {
73
+ if (ee.code != 500) {
74
+ return;
75
+ }
76
+ if (ee.error.type == 'BAD_LOGIN_OR_PASSWORD') {
77
+ await this.setErrorBadLoginOrPasswd();
78
+ return;
79
+ }
80
+ }
65
81
  async handle2() {
66
82
  let x = await this.valid();
67
83
  if (!x) {
@@ -75,12 +91,17 @@ class BaseForm extends _react.Component {
75
91
  this2.props.onSucc(ss.data);
76
92
  }, ee => {
77
93
  //if ()
94
+ this2.setError(ee);
78
95
  console.log("XxxiiiixXX3eeee", ee);
79
96
  });
80
97
  }
81
98
  render() {
82
99
  let error = null;
83
100
  let lab1 = this.props.lab1;
101
+ let extraButt = !_educoreapp.Tools.empty(this.extraButt) ? this.extraButt : /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
102
+ color: "primary",
103
+ type: "submit"
104
+ }, lab1);
84
105
  if (_educoreapp.Tools.empty(lab1)) {
85
106
  lab1 = "Login";
86
107
  }
@@ -89,10 +110,7 @@ class BaseForm extends _react.Component {
89
110
  onSubmit: this.handleSubmit
90
111
  }, error && /*#__PURE__*/_react.default.createElement(_reactstrap.Alert, {
91
112
  color: "danger"
92
- }, error), this.props.children, /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
93
- color: "primary",
94
- type: "submit"
95
- }, lab1));
113
+ }, error), this.props.children, extraButt);
96
114
  }
97
115
  }
98
116
  var _default = exports.default = BaseForm;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "educoreapp2",
3
3
  "private": false,
4
- "version": "1.0.36",
4
+ "version": "1.0.38",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "files": [