-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
36 lines (33 loc) · 814 Bytes
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {
Text,
View,
SafeAreaView,
TextInput,
TouchableOpacity,
Image,
} from "react-native";
import { useState, useEffect } from "react";
import { supabase } from "./lib/supabase";
import Auth from "./components/Auth";
import Account from "./components/Account";
import { Session } from "@supabase/supabase-js";
export default function App() {
const [session, setSession] = useState<Session | null>(null);
useEffect(() => {
supabase.auth.getSession().then(({ data: { session } }) => {
setSession(session);
});
supabase.auth.onAuthStateChange((_event, session) => {
setSession(session);
});
}, []);
return (
<>
{session && session.user ? (
<Account key={session.user.id} session={session} />
) : (
<Auth />
)}
</>
);
}