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/bug/BugQuery.tsx | |
parent | bce4d095e16fb33d181b29aa1d3476037c0c873a (diff) | |
download | git-bug-b0eb041e571dd616a9926d969bb42b3e7d6512e9.tar.gz |
webui: upgrade react-router
Diffstat (limited to 'webui/src/pages/bug/BugQuery.tsx')
-rw-r--r-- | webui/src/pages/bug/BugQuery.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/webui/src/pages/bug/BugQuery.tsx b/webui/src/pages/bug/BugQuery.tsx index fd0fb9d4..6b31197d 100644 --- a/webui/src/pages/bug/BugQuery.tsx +++ b/webui/src/pages/bug/BugQuery.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'; @@ -8,13 +8,12 @@ import NotFoundPage from '../notfound/NotFoundPage'; import Bug from './Bug'; import { useGetBugQuery } from './BugQuery.generated'; -type Props = RouteComponentProps<{ - id: string; -}>; +const BugQuery: React.FC = () => { + const params = useParams<'id'>(); + if (params.id === undefined) throw new Error('missing route parameters'); -const BugQuery: React.FC<Props> = ({ match }: Props) => { const { loading, error, data } = useGetBugQuery({ - variables: { id: match.params.id }, + variables: { id: params.id }, }); if (loading) return <CircularProgress />; if (!data?.repository?.bug) return <NotFoundPage />; |