Skip to content

Commit 8407634

Browse files
committed
fix #1101
1 parent 8e87b6f commit 8407634

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/TableEditColumn.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,12 @@ class TableEditColumn extends Component {
7373
const responseType = typeof checkVal;
7474
if (responseType !== 'object' && checkVal !== true) {
7575
valid = false;
76-
const toastr = this.props.beforeShowError &&
77-
this.props.beforeShowError('error', checkVal, Const.CANCEL_TOASTR);
78-
if (toastr) {
79-
ts.refs.notifier.notice('error', checkVal, Const.CANCEL_TOASTR);
80-
}
76+
this.notifyToastr('error', checkVal, Const.CANCEL_TOASTR);
8177
} else if (responseType === 'object' && checkVal.isValid !== true) {
8278
valid = false;
83-
const toastr = this.props.beforeShowError &&
84-
this.props.beforeShowError(checkVal.notification.type,
85-
checkVal.notification.msg,
86-
checkVal.notification.title);
87-
if (toastr) {
88-
ts.refs.notifier.notice(checkVal.notification.type,
89-
checkVal.notification.msg,
90-
checkVal.notification.title);
91-
}
79+
this.notifyToastr(checkVal.notification.type,
80+
checkVal.notification.msg,
81+
checkVal.notification.title);
9282
}
9383
if (!valid) {
9484
// animate input
@@ -109,6 +99,17 @@ class TableEditColumn extends Component {
10999
}
110100
// END
111101

102+
notifyToastr = (type, message, title) => {
103+
let toastr = true;
104+
const { beforeShowError } = this.props;
105+
if (beforeShowError) {
106+
toastr = beforeShowError(type, message, title);
107+
}
108+
if (toastr) {
109+
this.refs.notifier.notice(type, message, title);
110+
}
111+
}
112+
112113
clearTimeout() {
113114
if (this.timeouteClear !== 0) {
114115
clearTimeout(this.timeouteClear);

0 commit comments

Comments
 (0)