Skip to content

Commit

Permalink
Expo > Don't router.replace() on dismiss web view (#1079)
Browse files Browse the repository at this point in the history
Co-authored-by: dbianchii <dbianchii@gmail.com>
Co-authored-by: juliusmarminge <julius0216@outlook.com>
  • Loading branch information
3 people authored Oct 16, 2024
1 parent 51b0657 commit e5620dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/expo/src/utils/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export const signIn = async () => {
redirectTo,
);

if (result.type !== "success") return;
if (result.type !== "success") return false;
const url = Linking.parse(result.url);
const sessionToken = String(url.queryParams?.session_token);
if (!sessionToken) return;
if (!sessionToken) throw new Error("No session token found");

setToken(sessionToken);

return true;
};

export const useUser = () => {
Expand All @@ -32,7 +34,9 @@ export const useSignIn = () => {
const router = useRouter();

return async () => {
await signIn();
const success = await signIn();
if (!success) return;

await utils.invalidate();
router.replace("/");
};
Expand Down

0 comments on commit e5620dd

Please sign in to comment.