Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions e2e/pages/CustomLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,42 @@ export default class CustomLogin extends React.Component {

constructor(props) {
super(props);
this.state = {
this._signInInFlight = false;
this.state = {
isLoading: false,
username: '',
password: '',
};
};
}

async componentDidMount() {

}

signInCustom = () => {
// Guard against concurrent sign-in calls. setState is async so isLoading
// alone cannot prevent a second call from entering before the first render.
if (this._signInInFlight) {
return;
}
this._signInInFlight = true;
this.setState({ isLoading: true });
signIn({ username: this.state.username, password: this.state.password })
.then(() => {
introspectIdToken()
.then(idToken => {
this.props.navigation.navigate('ProfilePage', { idToken: idToken, isBrowserScenario: false });
}).finally(() => {
this.setState({
this._signInInFlight = false;
this.setState({
isLoading: false,
username: '',
username: '',
password: '',
});
});
})
.catch(error => {
this._signInInFlight = false;
// For some reason the app crashes when only one button exist (only with loaded bundle, debug is OK) 🤦‍♂️
Alert.alert(
"Error",
Expand All @@ -72,7 +81,6 @@ export default class CustomLogin extends React.Component {
{ text: "OK", onPress: () => console.log("OK Pressed") }
]
);


this.setState({
isLoading: false
Expand Down
Loading