Skip to content

Commit

Permalink
refactor SearchTypeahead
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-takei committed Dec 20, 2021
1 parent 4f0abe0 commit ada1e62
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/app/src/components/SearchTypeahead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AsyncTypeahead } from 'react-bootstrap-typeahead';
import { UserPicture, PageListMeta, PagePathLabel } from '@growi/ui';

import AppContainer from '~/client/services/AppContainer';
import { withUnstatedContainers } from './UnstatedUtils';
import { apiGet } from '~/client/util/apiv1-client';

class SearchTypeahead extends React.Component {

Expand Down Expand Up @@ -80,7 +80,7 @@ class SearchTypeahead extends React.Component {

this.setState({ isLoading: true });

this.props.appContainer.apiGet('/search', { q: keyword })
apiGet('/search', { q: keyword })
.then((res) => { this.onSearchSuccess(res) })
.catch((err) => { this.onSearchError(err) });
}
Expand Down Expand Up @@ -229,11 +229,6 @@ class SearchTypeahead extends React.Component {

}

/**
* Wrapper component for using unstated
*/
const SearchTypeaheadWrapper = withUnstatedContainers(SearchTypeahead, [AppContainer]);

/**
* Properties
*/
Expand Down Expand Up @@ -271,4 +266,4 @@ SearchTypeahead.defaultProps = {
onInputChange: () => {},
};

export default SearchTypeaheadWrapper;
export default SearchTypeahead;

0 comments on commit ada1e62

Please sign in to comment.