diff options
author | Quentin Gliech <quentingliech@gmail.com> | 2022-02-22 20:38:32 +0100 |
---|---|---|
committer | Quentin Gliech <quentingliech@gmail.com> | 2022-02-22 20:38:32 +0100 |
commit | b0eb041e571dd616a9926d969bb42b3e7d6512e9 (patch) | |
tree | 5e6965b98386adb0fcd3548dc69e46daf788ccbb /webui/src/pages/identity/IdentityQuery.tsx | |
parent | bce4d095e16fb33d181b29aa1d3476037c0c873a (diff) | |
download | git-bug-b0eb041e571dd616a9926d969bb42b3e7d6512e9.tar.gz |
webui: upgrade react-router
Diffstat (limited to 'webui/src/pages/identity/IdentityQuery.tsx')
-rw-r--r-- | webui/src/pages/identity/IdentityQuery.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/webui/src/pages/identity/IdentityQuery.tsx b/webui/src/pages/identity/IdentityQuery.tsx index 762c17cc..5a3b2616 100644 --- a/webui/src/pages/identity/IdentityQuery.tsx +++ b/webui/src/pages/identity/IdentityQuery.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { RouteComponentProps } from 'react-router-dom'; +import { useParams } from 'react-router-dom'; import CircularProgress from '@material-ui/core/CircularProgress'; @@ -7,13 +7,12 @@ import { useGetUserByIdQuery } from '../../components/Identity/UserIdentity.gene import Identity from './Identity'; -type Props = RouteComponentProps<{ - id: string; -}>; +const UserQuery: React.FC = () => { + const params = useParams<'id'>(); + if (params.id === undefined) throw new Error(); -const UserQuery: React.FC<Props> = ({ match }: Props) => { const { loading, error, data } = useGetUserByIdQuery({ - variables: { userId: match.params.id }, + variables: { userId: params.id }, }); if (loading) return <CircularProgress />; if (error) return <p>Error: {error}</p>; |