[clean up][xs]: removed unnecessary imports.

This commit is contained in:
anuveyatsu
2020-06-24 14:59:54 +06:00
parent 5e62325c91
commit 0dbe145e8c
7 changed files with 24 additions and 37 deletions

View File

@@ -1,5 +1,4 @@
import ErrorMessage from '../Error'; import ErrorMessage from '../Error';
import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';
@@ -21,16 +20,13 @@ export const GET_DATAPACKAGE_QUERY = gql`
`; `;
export default function About({ variables }) { export default function About({ variables }) {
const { loading, error, data, fetchMore, networkStatus } = useQuery( const { loading, error, data } = useQuery(GET_DATAPACKAGE_QUERY, {
GET_DATAPACKAGE_QUERY,
{
variables, variables,
// Setting this value to true will make the component rerender when // Setting this value to true will make the component rerender when
// the "networkStatus" changes, so we are able to know if it is fetching // the "networkStatus" changes, so we are able to know if it is fetching
// more data // more data
notifyOnNetworkStatusChange: true, notifyOnNetworkStatusChange: true,
} });
);
if (error) return <ErrorMessage message="Error loading dataset." />; if (error) return <ErrorMessage message="Error loading dataset." />;
if (loading) return <div>Loading</div>; if (loading) return <div>Loading</div>;

View File

@@ -1,6 +1,5 @@
import Link from 'next/link'; import Link from 'next/link';
import ErrorMessage from '../Error'; import ErrorMessage from '../Error';
import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';
@@ -19,16 +18,13 @@ export const GET_ORG_QUERY = gql`
`; `;
export default function Org({ variables }) { export default function Org({ variables }) {
const { loading, error, data, fetchMore, networkStatus } = useQuery( const { loading, error, data } = useQuery(GET_ORG_QUERY, {
GET_ORG_QUERY,
{
variables, variables,
// Setting this value to true will make the component rerender when // Setting this value to true will make the component rerender when
// the "networkStatus" changes, so we are able to know if it is fetching // the "networkStatus" changes, so we are able to know if it is fetching
// more data // more data
notifyOnNetworkStatusChange: true, notifyOnNetworkStatusChange: true,
} });
);
if (error) return <ErrorMessage message="Error loading dataset." />; if (error) return <ErrorMessage message="Error loading dataset." />;
if (loading) return <div>Loading</div>; if (loading) return <div>Loading</div>;

View File

@@ -1,6 +1,5 @@
import Link from 'next/link'; import Link from 'next/link';
import ErrorMessage from '../Error'; import ErrorMessage from '../Error';
import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';
@@ -22,16 +21,13 @@ export const GET_DATAPACKAGE_QUERY = gql`
`; `;
export default function Resources({ variables }) { export default function Resources({ variables }) {
const { loading, error, data, fetchMore, networkStatus } = useQuery( const { loading, error, data } = useQuery(GET_DATAPACKAGE_QUERY, {
GET_DATAPACKAGE_QUERY,
{
variables, variables,
// Setting this value to true will make the component rerender when // Setting this value to true will make the component rerender when
// the "networkStatus" changes, so we are able to know if it is fetching // the "networkStatus" changes, so we are able to know if it is fetching
// more data // more data
notifyOnNetworkStatusChange: true, notifyOnNetworkStatusChange: true,
} });
);
if (error) return <ErrorMessage message="Error loading dataset." />; if (error) return <ErrorMessage message="Error loading dataset." />;
if (loading) return <div>Loading</div>; if (loading) return <div>Loading</div>;

View File

@@ -1,6 +1,5 @@
import Link from 'next/link'; import Link from 'next/link';
import ErrorMessage from '../Error'; import ErrorMessage from '../Error';
import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';

View File

@@ -1,6 +1,5 @@
import Link from 'next/link'; import Link from 'next/link';
import ErrorMessage from '../Error'; import ErrorMessage from '../Error';
import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';

View File

@@ -1,6 +1,5 @@
import Item from './Item'; import Item from './Item';
import ErrorMessage from '../Error'; import ErrorMessage from '../Error';
import { NetworkStatus } from 'apollo-client';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';
@@ -23,7 +22,7 @@ const QUERY = gql`
`; `;
export default function List({ variables }) { export default function List({ variables }) {
const { loading, error, data, fetchMore, networkStatus } = useQuery(QUERY, { const { loading, error, data } = useQuery(QUERY, {
variables, variables,
// Setting this value to true will make the component rerender when // Setting this value to true will make the component rerender when
// the "networkStatus" changes, so we are able to know if it is fetching // the "networkStatus" changes, so we are able to know if it is fetching

View File

@@ -1,3 +1,4 @@
import ErrorMessage from '../Error';
import { useQuery } from '@apollo/react-hooks'; import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag'; import gql from 'graphql-tag';
@@ -21,6 +22,7 @@ export default function Total({ variables }) {
notifyOnNetworkStatusChange: true, notifyOnNetworkStatusChange: true,
}); });
if (error) return <ErrorMessage message="Error loading search results." />;
if (loading) return <div>Loading</div>; if (loading) return <div>Loading</div>;
const { result } = data.search; const { result } = data.search;