steemConnect login bug fixes

This commit is contained in:
Hüseyin Terkir 2018-09-20 15:48:00 +03:00
parent 89aa175914
commit c2920b1fad
3 changed files with 29 additions and 13 deletions

View File

@ -179,8 +179,7 @@ export const loginWithSC2 = async (access_token, pinCode) => {
await steemConnect.setAccessToken(access_token);
account = await steemConnect.me();
console.log(account._id);
console.log(account.name);
//console.log(account.name);
return new Promise((resolve, reject) => {

View File

@ -4,19 +4,29 @@ import { Text, View } from "react-native";
import { goToAuthScreens, goToNoAuthScreens } from "../../navigation";
import SplashScreen from "./splashScreen";
import { getAuthStatus } from "../../realm/realm";
class SplashContainer extends React.Component {
constructor(props) {
super(props);
}
constructor(props) {
super(props);
}
componentDidMount() {
goToNoAuthScreens();
}
componentDidMount() {
getAuthStatus().then(result => {
if(result === true) {
goToAuthScreens();
} else {
goToNoAuthScreens();
}
}).catch(error => {
console.log(error);
goToAuthScreens();
});
}
render() {
return <SplashScreen />;
}
render() {
return <SplashScreen />;
}
}
export default SplashContainer;

View File

@ -13,14 +13,21 @@ export default class SteemConnect extends Component {
}
onNavigationStateChange(event) {
let access_token = event.url.match(/\?(?:access_token)\=([\S\s]*?)\&/)[1];
let access_token;
try {
access_token = event.url.match(/\?(?:access_token)\=([\S\s]*?)\&/)[1];
} catch (error) {
console.log(error);
}
if(access_token) {
loginWithSC2(access_token, "pinCode").then(result => {
if(result === true) {
// TODO: Handle pinCode and navigate to home page
Navigation.dismissModal(this.props.componentId);
RNRestart.Restart();
} else {
Navigation.dismissModal(this.props.componentId);
// TODO: Error alert (Toast Message)
}
});
}