Improved vote eror handling

This commit is contained in:
Arnaud Vergnet 2020-04-08 20:36:02 +02:00
parent 71f39a64cc
commit 299a940ba4
2 changed files with 9 additions and 5 deletions

View file

@ -32,7 +32,6 @@ class AuthenticatedScreen extends React.Component<Props, State> {
this.props.navigation.addListener('focus', this.onScreenFocus);
this.fetchedData = new Array(this.props.links.length);
this.errors = new Array(this.props.links.length);
this.fetchData(); // TODO remove in prod (only use for fast refresh)
}
/**

View file

@ -53,7 +53,9 @@ const FAKE_TEAMS2 = {
],
};
type Props = {}
type Props = {
navigation: Object
}
type State = {
hasVoted: boolean,
@ -135,9 +137,12 @@ export default class VoteScreen extends React.Component<Props, State> {
return null;
};
getScreen = (data: Array<Object>) => {
data[0] = FAKE_TEAMS2;
data[1] = FAKE_DATE;
getScreen = (data: Array<Object | null>) => {
// data[0] = FAKE_TEAMS2;
// data[1] = FAKE_DATE;
if (data[1] === null)
data[1] = {date_begin: null};
if (data[0] !== null) {
this.teams = data[0].teams;