Skip to content

Commit 8afcba5

Browse files
committed
promise warning
1 parent 81d134e commit 8afcba5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

App/Stores/CurrentUserStore.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,17 @@ var SingletonStore = assign({}, EventEmitter.prototype, {
6666
Dispatcher.register(function(action) {
6767
switch(action.actionType) {
6868
case AppConstants.APP_LAUNCHED:
69-
Keychain.getGenericPassword(KEYCHAIN_SERVICE, function(keychainError, username, token) {
70-
LocalKeyStore.getKey(LOCAL_STORE_KEY, function(storeError, props) {
71-
initSingleton(props, token, username);
69+
Keychain.getGenericPassword(KEYCHAIN_SERVICE).then((values) => {
70+
const { username, password } = values || {};
71+
// password is the stored token.
72+
LocalKeyStore.getKey(LOCAL_STORE_KEY, (storeError, props) => {
73+
initSingleton(props, password, username);
7274
SingletonStore.emitChange();
7375
});
76+
}).catch((error) => {
77+
console.log(error);
78+
initSingleton({}, null, null);
79+
SingletonStore.emitChange();
7480
});
7581
break;
7682
case AppConstants.LOGIN_USER:

0 commit comments

Comments
 (0)