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.props.navigation.addListener('focus', this.onScreenFocus);
this.fetchedData = new Array(this.props.links.length); this.fetchedData = new Array(this.props.links.length);
this.errors = 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 = { type State = {
hasVoted: boolean, hasVoted: boolean,
@ -135,9 +137,12 @@ export default class VoteScreen extends React.Component<Props, State> {
return null; return null;
}; };
getScreen = (data: Array<Object>) => { getScreen = (data: Array<Object | null>) => {
data[0] = FAKE_TEAMS2; // data[0] = FAKE_TEAMS2;
data[1] = FAKE_DATE; // data[1] = FAKE_DATE;
if (data[1] === null)
data[1] = {date_begin: null};
if (data[0] !== null) { if (data[0] !== null) {
this.teams = data[0].teams; this.teams = data[0].teams;