|
|
@@ -1,30 +1,43 @@
|
|
|
import React, { Fragment } from 'react';
|
|
|
+import PropTypes from 'prop-types';
|
|
|
+
|
|
|
+import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
+import AppContainer from '../../../services/AppContainer';
|
|
|
|
|
|
class FullTextSearchManagement extends React.Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
- super();
|
|
|
+ super(props);
|
|
|
+
|
|
|
+ this.Buildindex = this.Buildindex.bind(this);
|
|
|
}
|
|
|
|
|
|
Buildindex(event) {
|
|
|
- const axios = require('axios').create({
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- 'X-Requested-With': 'XMLHttpRequest',
|
|
|
- },
|
|
|
- responseType: 'json',
|
|
|
- });
|
|
|
- axios.post('http://localhost:3000/_api/admin/search/build');
|
|
|
+
|
|
|
+ const { appContainer } = this.props;
|
|
|
+ const pageId = this.props.pageId;
|
|
|
+
|
|
|
+ appContainer.apiPost('/admin/search/build', { page_id: pageId })
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
return (
|
|
|
<Fragment>
|
|
|
- <button type="submit" className="btn btn-inverse" onClick={() => { return this.Buildindex() }}>Build Now</button>
|
|
|
+ <div>
|
|
|
+ <button type="submit" className="btn btn-inverse" onClick={this.Buildindex}>Build Now</button>
|
|
|
+ </div>
|
|
|
</Fragment>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
-export default FullTextSearchManagement;
|
|
|
+const FullTextSearchManagementWrapper = (props) => {
|
|
|
+ return createSubscribedElement(FullTextSearchManagement, props, [AppContainer]);
|
|
|
+};
|
|
|
+
|
|
|
+FullTextSearchManagement.propTypes = {
|
|
|
+ appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
+};
|
|
|
+
|
|
|
+export default FullTextSearchManagementWrapper;
|