aboutsummaryrefslogblamecommitdiffstats
path: root/webui/src/BugPage.js
blob: 0f4158410a393a6a52cfda326312d35bf06e5f7b (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                  




                              










                                                           
                                                      




                       
import React from "react";
import { Query } from "react-apollo";
import gql from "graphql-tag";

import CircularProgress from "@material-ui/core/CircularProgress";

import Bug from "./Bug";

const QUERY = gql`
  query GetBug($id: String!) {
    defaultRepository {
      bug(prefix: $id) {
        ...Bug
      }
    }
  }

  ${Bug.fragment}
`;

const BugPage = ({ match }) => (
  <Query query={QUERY} variables={{ id: match.params.id }}>
    {({ loading, error, data }) => {
      if (loading) return <CircularProgress />;
      if (error) return <p>Error.</p>;
      return <Bug bug={data.defaultRepository.bug} />;
    }}
  </Query>
);

export default BugPage;