Skip to content
22 linesCodeBlameRaw
1import { Redirect } from "expo-router";
2
3import { Loading, Screen } from "@/components/ui";
4import { useSession } from "@/lib/session";
5
6/**
7 * Where the site sends the person back after they approve the app
8 * (`g1t://oauth/callback`). The sign-in screen's browser session reads
9 * the code from the address itself (lib/oauth.ts); this screen is only
10 * what shows if the link opens the app on its own, and it moves on.
11 */
12export default function OAuthCallback() {
13 const { state } = useSession();
14 if (state.status === "loading") {
15 return (
16 <Screen>
17 <Loading />
18 </Screen>
19 );
20 }
21 return <Redirect href={state.status === "signed-in" ? "/chat" : "/sign-in"} />;
22}