Skip to content

Commit

Permalink
WIP WIP use own-email from /register rather than auth
Browse files Browse the repository at this point in the history
This probably doesn't totally work as is -- there are probably some
places we want the email before we have the /register response, as
well as places we want the delivery_email.  But I think it's the core
of the fix to zulip#3196.
  • Loading branch information
gnprice committed Jul 13, 2019
1 parent cec71f5 commit 97c61b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/account/accountsSelectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ export const getActiveAccount = (state: GlobalState): Account => {
};

/** The user's own email in the active account; throws if none. */
export const getOwnEmail = (state: GlobalState): string => getActiveAccount(state).email;
export const getOwnEmail = (state: GlobalState): string => {
const { email } = state.realm;
if (email === undefined) {
throw new Error('No server data found');
}
return email;
};

/** The realm of the active account; throws if none. */
export const getCurrentRealm = (state: GlobalState) => getActiveAccount(state).realm;
Expand Down

0 comments on commit 97c61b4

Please sign in to comment.