Skip to content

Commit

Permalink
refactor: apply pull request feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pac-guerreiro committed Dec 18, 2023
1 parent f6b43db commit 7a8e43e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/pages/LogInWithShortLivedAuthTokenPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ function LogInWithShortLivedAuthTokenPage({route, account}: LogInWithShortLivedA
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
const {
params: {email, shortLivedAuthToken, shortLivedToken, exitTo, error},
} = route;
const {email = '', shortLivedAuthToken = '', shortLivedToken = '', exitTo, error} = route?.params ?? {};

useEffect(() => {
// We have to check for both shortLivedAuthToken and shortLivedToken, as the old mobile app uses shortLivedToken, and is not being actively updated.
const token = shortLivedAuthToken ?? shortLivedToken;
const token = shortLivedAuthToken || shortLivedToken;

// Try to authenticate using the shortLivedToken if we're not already trying to load the accounts
if (email && token && !account?.isLoading) {
if (token && !account?.isLoading) {
Session.signInWithShortLivedAuthToken(email, token);
return;
}
Expand Down

0 comments on commit 7a8e43e

Please sign in to comment.