@@ -73,22 +73,12 @@ class TableEditColumn extends Component {
73
73
const responseType = typeof checkVal ;
74
74
if ( responseType !== 'object' && checkVal !== true ) {
75
75
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 ) ;
81
77
} else if ( responseType === 'object' && checkVal . isValid !== true ) {
82
78
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 ) ;
92
82
}
93
83
if ( ! valid ) {
94
84
// animate input
@@ -109,6 +99,17 @@ class TableEditColumn extends Component {
109
99
}
110
100
// END
111
101
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
+
112
113
clearTimeout ( ) {
113
114
if ( this . timeouteClear !== 0 ) {
114
115
clearTimeout ( this . timeouteClear ) ;
0 commit comments