itizawa 5 лет назад
Родитель
Сommit
80f77ba517

+ 1 - 0
src/client/js/components/Page/TagEditModal.jsx

@@ -36,6 +36,7 @@ export default class TagEditModal extends React.Component {
 
   async handleSubmit() {
     this.props.onTagsUpdated(this.state.tags);
+    this.closeModalHandler();
   }
 
   render() {

+ 3 - 27
src/client/js/components/Page/TagLabels.jsx

@@ -2,7 +2,7 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import { withTranslation } from 'react-i18next';
 
-import * as toastr from 'toastr';
+import { toastSuccess, toastError } from '../../util/apiNotification';
 
 import { withUnstatedContainers } from '../UnstatedUtils';
 import AppContainer from '../../services/AppContainer';
@@ -62,37 +62,13 @@ class TagLabels extends React.Component {
       pageContainer.setState({ tags });
       editorContainer.setState({ tags });
 
-      this.apiSuccessHandler();
+      toastSuccess('updated tags successfully');
     }
     catch (err) {
-      this.apiErrorHandler(err);
-      return;
+      toastError(err, 'fail to update tags');
     }
   }
 
-  apiSuccessHandler() {
-    toastr.success(undefined, 'updated tags successfully', {
-      closeButton: true,
-      progressBar: true,
-      newestOnTop: false,
-      showDuration: '100',
-      hideDuration: '100',
-      timeOut: '1200',
-      extendedTimeOut: '150',
-    });
-  }
-
-  apiErrorHandler(err) {
-    toastr.error(err.message, 'Error occured', {
-      closeButton: true,
-      progressBar: true,
-      newestOnTop: false,
-      showDuration: '100',
-      hideDuration: '100',
-      timeOut: '3000',
-    });
-  }
-
   render() {
     const { t } = this.props;
     const { pageId } = this.props.pageContainer.state;