From b4634abff4122c3d419baa41924be6cd4a98e8ce Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 28 Nov 2019 15:38:59 +0200 Subject: [PATCH] Fix new account setup. We were getting a 404 because the user info doesn't exist, and were erroring because of it, which was not calling the then (just the catch). We now handle the error condition. --- src/LoginGate.tsx | 2 ++ src/SyncGate.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/LoginGate.tsx b/src/LoginGate.tsx index facb47e..3a8e780 100644 --- a/src/LoginGate.tsx +++ b/src/LoginGate.tsx @@ -29,6 +29,8 @@ function EncryptionPart(props: { credentials: CredentialsType }) { // FIXME: verify the error is a 404 store.dispatch(fetchUserInfo(credentials, credentials.credentials.email)).then((fetchedUserInfo: Action) => { setUserInfo(fetchedUserInfo.payload); + }).catch(() => { + // Do nothing. }).finally(() => { setFetched(true); }); diff --git a/src/SyncGate.tsx b/src/SyncGate.tsx index f474c91..bec8375 100644 --- a/src/SyncGate.tsx +++ b/src/SyncGate.tsx @@ -146,7 +146,7 @@ class SyncGate extends React.PureComponent { syncAll(); } else { const fetching = store.dispatch(fetchUserInfo(this.props.etesync, me)) as any; - fetching.then(sync); + fetching.then(sync).catch(() => sync()); } }