|
@@ -2,13 +2,33 @@ import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
|
|
+import loggerFactory from '@alias/logger';
|
|
|
|
|
+
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
|
|
+import { toastError } from '../../../util/apiNotification';
|
|
|
|
|
|
|
|
import AppContainer from '../../../services/AppContainer';
|
|
import AppContainer from '../../../services/AppContainer';
|
|
|
import SlackAppConfiguration from './SlackAppConfiguration';
|
|
import SlackAppConfiguration from './SlackAppConfiguration';
|
|
|
|
|
+import AdminNotificationContainer from '../../../services/AdminNotificationContainer';
|
|
|
|
|
+
|
|
|
|
|
+const logger = loggerFactory('growi:NotificationSetting');
|
|
|
|
|
|
|
|
class NotificationSetting extends React.Component {
|
|
class NotificationSetting extends React.Component {
|
|
|
|
|
|
|
|
|
|
+ async componentDidMount() {
|
|
|
|
|
+ const { adminNotificationContainer } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await adminNotificationContainer.retrieveNotificationData();
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ toastError(err);
|
|
|
|
|
+ adminNotificationContainer.setState({ retrieveError: err });
|
|
|
|
|
+ logger.error(err);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -43,12 +63,13 @@ class NotificationSetting extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const NotificationSettingWrapper = (props) => {
|
|
const NotificationSettingWrapper = (props) => {
|
|
|
- return createSubscribedElement(NotificationSetting, props, [AppContainer]);
|
|
|
|
|
|
|
+ return createSubscribedElement(NotificationSetting, props, [AppContainer, AdminNotificationContainer]);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
NotificationSetting.propTypes = {
|
|
NotificationSetting.propTypes = {
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
|
|
+ adminNotificationContainer: PropTypes.instanceOf(AdminNotificationContainer).isRequired,
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|