Skip to content
Permalink
Browse files

Added error handling

  • Loading branch information...
jackycodes committed Jun 13, 2019
1 parent 25914af commit 2beec019a3b485443d779b7579b57c6510b4003d
Showing with 14 additions and 10 deletions.
  1. +14 −10 TestApp/app/screens/AppCenterScreen.js
@@ -213,7 +213,7 @@ export default class AppCenterScreen extends Component {
toggle: async () => {
await Auth.setEnabled(!this.state.authEnabled);
const authEnabled = await Auth.isEnabled();
this.setState({ authEnabled, accountId: '' });
this.setState({ authEnabled, accountId: '', isTokenSet: false });
}
},
{
@@ -253,8 +253,12 @@ export default class AppCenterScreen extends Component {
{
title: 'Sign In',
action: async () => {
const result = await Auth.signIn();
this.setState({ accountId: result.accountId, isTokenSet: !!result.accessToken });
try {
const result = await Auth.signIn();
this.setState({ accountId: result.accountId, isTokenSet: !!result.accessToken });
} catch (e) {
console.log(e);
}
}
},
{
@@ -272,13 +276,6 @@ export default class AppCenterScreen extends Component {
data: [
{ title: 'Install ID', value: 'installId' },
{ title: 'SDK Version', value: 'sdkVersion' },
{
title: 'Account ID',
value: 'accountId',
onChange: async (accountId) => {
this.setState({ accountId });
}
},
{
title: 'User ID',
value: 'userId',
@@ -296,6 +293,13 @@ export default class AppCenterScreen extends Component {
await AppCenter.setUserId(userId);
}
},
{
title: 'Account ID',
value: 'accountId',
onChange: async (accountId) => {
this.setState({ accountId });
}
},
{
title: 'Is Token Set',
value: 'isTokenSet',

0 comments on commit 2beec01

Please sign in to comment.
You can’t perform that action at this time.