Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._service.onLogin((/* err, */ /* res */) => {
// console.log('onLogink', err, res, this._service.service.loggedInUser);
if (this._mounted && this._service.service.loggedInUser) {
if (this._service.service.loggedInUser.username) {
Actions.app({ type: 'reset' });
}
}
});
this._mounted = true;
}, () => {
// console.log('RegCB 01', lerr, lres);
if (this._net.service.loggedInUser && this._net.service.loggedInUser.username) {
Actions.app({ type: 'reset' });
} else {
this.setState({ setUsername: true, alert: { success: '' } });
this._net.service.getUsernameSuggestion((Uerr, Ures) => {
if (Uerr) {
this.setState({ alert: { error: 'Error fetching username!' } });
} else if (Ures) {
this.setState({ inputUsername: Ures });
}
});
}
});
});
.then(() => Actions.app({ type: 'reset' }))
// Not Logged in, show Login screen
this._service.onLogin(() => {
if (this._mounted && this._service.service.loggedInUser) {
// this._service.switchToLoggedInUser();
Actions.app({ type: 'reset' });
}
});
// Get server name
.then((token) => {
Actions.app({type: 'reset'});
// connect to websocket
Actions.app({type: 'CONNECT', token});
})
// Not Logged in, show Login screen
setTimeout(() => {
Actions.app({ type: 'reset' });
}, 1000);
});
setTimeout(() => {
Actions.app({type: 'reset'});
}, 2300);
});
onPress: () => { this.props.closeSideMenu(); Actions.app(); },
},
.then(() => {
Actions.app({ type: 'reset' });
Actions.pop();
}).catch(err => this.setState({ resultMsg: { error: err.message } }));
}
setTimeout(() => {
Actions.app({ type: 'reset' });
}, 1000);
});