blob: 964a9bacf07d02c33c4e3a85be5f88ff932611e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import CircularProgress from '@material-ui/core/CircularProgress';
import { useGetUserByIdQuery } from '../../components/Identity/UserIdentity.generated';
import Identity from './Identity';
type Props = RouteComponentProps<{
id: string;
}>;
const UserQuery: React.FC<Props> = ({ match }: Props) => {
const { loading, error, data } = useGetUserByIdQuery({
variables: { userId: match.params.id },
});
if (loading) return <CircularProgress />;
if (error) return <p>Error: {error}</p>;
if (!data?.repository?.identity) return <p>404.</p>;
return <Identity identity={data.repository.identity} />;
};
export default UserQuery;
|