Skip to content

Commit

Permalink
mobile: don't use async for sign in code
Browse files Browse the repository at this point in the history
  • Loading branch information
ericswpark committed Feb 25, 2024
1 parent 0cad291 commit f2ab26d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mobile/Screens/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ export const SignIn = (props) => {
const dismissKeyboard = () => {
Keyboard.dismiss();
};
const handleSignIn = async () => {
const handleSignIn = () => {
try {
const session = await account.createEmailSession(email, password);
const user = await account.get();
account.createEmailSession(email, password).then((session) => {
setSession(session);

setSession(session);
setLoggedInUser(user);
account.get().then((user) => {
setLoggedInUser(user);

// if sign-in successful, nav to next screen
navigation.navigate("navbar");
// if sign-in successful, nav to next screen
navigation.navigate("navbar");
});
});
} catch (error: any) {
if (error instanceof Error) {
setErrorMessage(error.message);
Expand Down

0 comments on commit f2ab26d

Please sign in to comment.