Logout user if token expires

This commit is contained in:
Arnaud Vergnet 2020-04-07 20:11:04 +02:00
parent 2ee3ed001c
commit 0ee0a6db3a

View file

@ -70,7 +70,12 @@ class AuthenticatedScreen extends React.Component<Props, State> {
: null;
this.errorCode = error;
if (this.allRequestsFinished())
if (this.errorCode === ERROR_TYPE.BAD_TOKEN) { // Token expired, logout user
this.connectionManager.disconnect()
.then(() => {
this.props.navigation.navigate("LoginScreen");
});
} else if (this.allRequestsFinished())
this.setState({loading: false});
}