|
|
@@ -5,6 +5,8 @@ import { withTranslation } from 'react-i18next';
|
|
|
|
|
|
import PaginationWrapper from './PaginationWrapper';
|
|
|
import TagCloudBox from './TagCloudBox';
|
|
|
+import { apiGet } from '../client/util/apiv1-client';
|
|
|
+import { toastError } from '../client/util/apiNotification';
|
|
|
|
|
|
class TagsList extends React.Component {
|
|
|
|
|
|
@@ -26,6 +28,12 @@ class TagsList extends React.Component {
|
|
|
await this.getTagList(1);
|
|
|
}
|
|
|
|
|
|
+ async componentDidUpdate() {
|
|
|
+ if (this.props.isOnReload) {
|
|
|
+ await this.getTagList(this.state.activePage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async handlePage(selectedPage) {
|
|
|
await this.getTagList(selectedPage);
|
|
|
}
|
|
|
@@ -33,7 +41,14 @@ class TagsList extends React.Component {
|
|
|
async getTagList(selectPageNumber) {
|
|
|
const limit = this.state.pagingLimit;
|
|
|
const offset = (selectPageNumber - 1) * limit;
|
|
|
- const res = await this.props.crowi.apiGet('/tags.list', { limit, offset });
|
|
|
+ let res;
|
|
|
+
|
|
|
+ try {
|
|
|
+ res = await apiGet('/tags.list', { limit, offset });
|
|
|
+ }
|
|
|
+ catch (error) {
|
|
|
+ toastError(error);
|
|
|
+ }
|
|
|
|
|
|
const totalTags = res.totalCount;
|
|
|
const tagData = res.data;
|
|
|
@@ -100,11 +115,12 @@ class TagsList extends React.Component {
|
|
|
}
|
|
|
|
|
|
TagsList.propTypes = {
|
|
|
- crowi: PropTypes.object.isRequired,
|
|
|
+ isOnReload: PropTypes.bool,
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
};
|
|
|
|
|
|
TagsList.defaultProps = {
|
|
|
+ isOnReload: false,
|
|
|
};
|
|
|
|
|
|
export default withTranslation()(TagsList);
|