()
| 23 | interface LaunchProps {} |
| 24 | |
| 25 | const Launch: React.FC<LaunchProps> = () => { |
| 26 | let { launchId } = useParams(); |
| 27 | // This ensures we pass a string, even if useParams returns `undefined` |
| 28 | launchId ??= ''; |
| 29 | const { data, loading, error } = useQuery<LaunchDetailsTypes.LaunchDetails, LaunchDetailsTypes.LaunchDetailsVariables>(GET_LAUNCH_DETAILS, { variables: { launchId } }); |
| 30 | |
| 31 | if (loading) return <Loading />; |
| 32 | if (error) return <p>ERROR: {error.message}</p>; |
| 33 | if (!data) return <p>Not found</p>; |
| 34 | |
| 35 | return ( |
| 36 | <Fragment> |
| 37 | <Header image={data.launch && data.launch.mission && data.launch.mission.missionPatch}>{data && data.launch && data.launch.mission && data.launch.mission.name}</Header> |
| 38 | <LaunchDetail {...data.launch} /> |
| 39 | <ActionButton {...data.launch} /> |
| 40 | </Fragment> |
| 41 | ); |
| 42 | }; |
| 43 | |
| 44 | export default Launch; |
nothing calls this directly
no outgoing calls
no test coverage detected