21 lines
624 B
JavaScript
21 lines
624 B
JavaScript
import React from "react";
|
|
import { useQuery } from "react-apollo";
|
|
import { QUERY_ALL_OWNERS } from "../../graphql/owners.queries";
|
|
import AlertComponent from "../alert/alert.component";
|
|
import OwnersListComponent from "./owners-list.component";
|
|
|
|
export default function OwnersListContainer() {
|
|
const { loading, error, data, refetch } = useQuery(QUERY_ALL_OWNERS, {
|
|
fetchPolicy: "network-only"
|
|
});
|
|
|
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
|
return (
|
|
<OwnersListComponent
|
|
loading={loading}
|
|
owners={data ? data.owners : null}
|
|
refetch={refetch}
|
|
/>
|
|
);
|
|
}
|