From a2721971ba82a6ba0e735bd06cf555a4c1bca84e Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Mon, 3 Feb 2020 23:08:26 +0100 Subject: webui: generate TS types for graphql queries --- webui/src/bug/BugQuery.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 webui/src/bug/BugQuery.tsx (limited to 'webui/src/bug/BugQuery.tsx') diff --git a/webui/src/bug/BugQuery.tsx b/webui/src/bug/BugQuery.tsx new file mode 100644 index 00000000..6bf525e6 --- /dev/null +++ b/webui/src/bug/BugQuery.tsx @@ -0,0 +1,20 @@ +import CircularProgress from '@material-ui/core/CircularProgress'; +import React from 'react'; +import { RouteComponentProps } from 'react-router-dom'; + +import { useGetBugQuery } from './BugQuery.generated'; +import Bug from './Bug'; + +type Props = RouteComponentProps<{ + id: string +}>; + +const BugQuery: React.FC = ({ match }: Props) => { + const { loading, error, data } = useGetBugQuery({ variables: { id: match.params.id } }); + if (loading) return ; + if (error) return

Error: {error}

; + if (!data?.defaultRepository?.bug) return

404.

; + return ; +}; + +export default BugQuery; -- cgit From 6a502c145bd8f2e2e1a9c0b103c11f0433c60737 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 4 Feb 2020 20:57:43 +0100 Subject: webui: convert bug list to typescript --- webui/src/bug/BugQuery.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'webui/src/bug/BugQuery.tsx') diff --git a/webui/src/bug/BugQuery.tsx b/webui/src/bug/BugQuery.tsx index 6bf525e6..b436db5a 100644 --- a/webui/src/bug/BugQuery.tsx +++ b/webui/src/bug/BugQuery.tsx @@ -6,11 +6,13 @@ import { useGetBugQuery } from './BugQuery.generated'; import Bug from './Bug'; type Props = RouteComponentProps<{ - id: string + id: string; }>; const BugQuery: React.FC = ({ match }: Props) => { - const { loading, error, data } = useGetBugQuery({ variables: { id: match.params.id } }); + const { loading, error, data } = useGetBugQuery({ + variables: { id: match.params.id }, + }); if (loading) return ; if (error) return

Error: {error}

; if (!data?.defaultRepository?.bug) return

404.

; -- cgit From 9ddcb4b09215f942cb7889f9756d426ad3c90253 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 11 Feb 2020 20:54:01 +0100 Subject: webui: force import order --- webui/src/bug/BugQuery.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui/src/bug/BugQuery.tsx') diff --git a/webui/src/bug/BugQuery.tsx b/webui/src/bug/BugQuery.tsx index b436db5a..ea7bb7da 100644 --- a/webui/src/bug/BugQuery.tsx +++ b/webui/src/bug/BugQuery.tsx @@ -2,8 +2,8 @@ import CircularProgress from '@material-ui/core/CircularProgress'; import React from 'react'; import { RouteComponentProps } from 'react-router-dom'; -import { useGetBugQuery } from './BugQuery.generated'; import Bug from './Bug'; +import { useGetBugQuery } from './BugQuery.generated'; type Props = RouteComponentProps<{ id: string; -- cgit From 465f7ca73d7093eeeecb6553c804d8cfb06e6652 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 11 Feb 2020 21:49:19 +0100 Subject: webui: stop using defaultRepository --- webui/src/bug/BugQuery.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'webui/src/bug/BugQuery.tsx') diff --git a/webui/src/bug/BugQuery.tsx b/webui/src/bug/BugQuery.tsx index ea7bb7da..2ecf718c 100644 --- a/webui/src/bug/BugQuery.tsx +++ b/webui/src/bug/BugQuery.tsx @@ -15,8 +15,8 @@ const BugQuery: React.FC = ({ match }: Props) => { }); if (loading) return ; if (error) return

Error: {error}

; - if (!data?.defaultRepository?.bug) return

404.

; - return ; + if (!data?.repository?.bug) return

404.

; + return ; }; export default BugQuery; -- cgit