update api calls to utilized network context

This commit is contained in:
John Mitchell
2019-04-08 12:34:02 -04:00
parent 722ae932ab
commit fa232a94bd
14 changed files with 163 additions and 126 deletions

View File

@@ -15,6 +15,8 @@ import {
import { I18n } from '@lingui/react';
import { Trans, t } from '@lingui/macro';
import { withNetwork } from '../../contexts/Network';
import CheckboxListItem from '../ListItem';
import DataListToolbar from '../DataListToolbar';
import SelectedList from '../SelectedList';
@@ -67,7 +69,7 @@ class Lookup extends React.Component {
}
async getData () {
const { getItems } = this.props;
const { getItems, handleHttpError } = this.props;
const { page, page_size, sortedColumnKey, sortOrder } = this.state;
this.setState({ error: false });
@@ -92,7 +94,7 @@ class Lookup extends React.Component {
this.setState(stateToUpdate);
} catch (err) {
this.setState({ error: true });
handleHttpError(err) || this.setState({ error: true });
}
}
@@ -273,4 +275,4 @@ Lookup.defaultProps = {
name: null,
};
export default Lookup;
export default withNetwork(Lookup);