فهرست منبع

change if statement more clearly

akira-s 6 سال پیش
والد
کامیت
2607128c9d
1فایلهای تغییر یافته به همراه8 افزوده شده و 5 حذف شده
  1. 8 5
      src/client/js/components/Admin/UserManagement.jsx

+ 8 - 5
src/client/js/components/Admin/UserManagement.jsx

@@ -37,13 +37,16 @@ class UserManagement extends React.Component {
   }
 
   handleClick(statusType) {
-    if (this.validateToggleStatus(statusType)) {
-      if (this.props.adminUsersContainer.state.notifyComment) this.setNotifyComment('');
-      this.props.adminUsersContainer.handleClick(statusType);
+    const { adminUsersContainer } = this.props;
+    if (!this.validateToggleStatus(statusType)) {
+      adminUsersContainer.setNotifyComment('You should check at least one checkbox.');
+      return;
     }
-    else {
-      this.setNotifyComment('You should check at least one checkbox.');
+
+    if (adminUsersContainer.state.notifyComment.length > 0) {
+      adminUsersContainer.setNotifyComment('');
     }
+    adminUsersContainer.handleClick(statusType);
   }
 
   validateToggleStatus(statusType) {