Skip to content

Commit

Permalink
Merge branch 'ui/#1026-list-network-issue' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Ruck committed Feb 5, 2020
2 parents dd61f86 + 833021c commit 7b14071
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
27 changes: 21 additions & 6 deletions packages/mobile-app/src/screens/Bundestag/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { pieChartGovernmentData } from '../../../lib/helper/PieChartGovernmentDa
import { ListFilterContext } from '../../../context/ListFilter';
import { NoConferenceWeekData } from './NoConferenceWeekData';
import { ConstituencyContext } from '../../../context/Constituency';
import { Centered } from '@democracy-deutschland/mobile-ui/src/components/shared/Centered';
import { Button } from '@democracy-deutschland/mobile-ui/src/components/Button';

type ListScreenRouteProp = RouteProp<
TopTabParamList,
Expand Down Expand Up @@ -71,12 +73,25 @@ export const List = () => {
return <ListLoading />;
}

if (error) {
return <Text>some error: {error.message}</Text>;
}

if (!data) {
return <Text>some error: No Data</Text>;
if (error || !data) {
return (
<Centered>
<Text>Verbindungsfehler</Text>
<Button
onPress={() =>
refetch({
listTypes: [route.params.list],
pageSize: 10,
filter: proceduresFilter,
constituencies,
})
}
text="Nochmal versuchen"
textColor="blue"
backgroundColor="transparent"
/>
</Centered>
);
}

if (
Expand Down
26 changes: 20 additions & 6 deletions packages/mobile-app/src/screens/Bundestag/Procedure/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import PrepareActions from './PrepareActions';
import { InitialStateContext } from '../../../context/InitialStates';
import { getShareLink } from '../../../lib/shareLink';
import { ConstituencyContext } from '../../../context/Constituency';
import { Centered } from '@democracy-deutschland/mobile-ui/src/components/shared/Centered';
import { Button } from '@democracy-deutschland/mobile-ui/src/components/Button';

const Container = styled.ScrollView`
background-color: #fff;
Expand All @@ -41,7 +43,7 @@ export const Procedure: FC<Props> = ({ route }) => {
const { isVerified } = useContext(InitialStateContext);
const { constituency } = useContext(ConstituencyContext);
const constituencies = constituency ? [constituency] : [];
const { data, loading, error } = useQuery<
const { data, loading, error, refetch } = useQuery<
ProcedureQueryObj,
ProcedureVariables
>(PROCEDURE, {
Expand All @@ -53,11 +55,23 @@ export const Procedure: FC<Props> = ({ route }) => {
if (loading) {
return <ListLoading />;
}
if (error) {
return <Text>{JSON.stringify(error)}</Text>;
}
if (!data) {
return <Text>procedure not found</Text>;
if (error || !data) {
return (
<Centered>
<Text>Verbindungsfehler</Text>
<Button
onPress={() =>
refetch({
id: route.params.procedureId,
constituencies,
})
}
text="Nochmal versuchen"
textColor="blue"
backgroundColor="transparent"
/>
</Centered>
);
}

const {
Expand Down

0 comments on commit 7b14071

Please sign in to comment.