mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
* feat: add push notifications example. * feat: add push notifications guide. * fix: remove trigger. * chore: americanize. * Apply suggestions from code review Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Apply suggestions from code review * Apply suggestions from code review * chore: run prettier. --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
32 lines
795 B
TypeScript
32 lines
795 B
TypeScript
import "react-native-url-polyfill/auto";
|
|
import { useState, useEffect } from "react";
|
|
import { supabase } from "./lib/supabase";
|
|
import Auth from "./components/Auth";
|
|
import Account from "./components/Account";
|
|
import { View } from "react-native";
|
|
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 (
|
|
<View>
|
|
{session && session.user ? (
|
|
<Account key={session.user.id} session={session} />
|
|
) : (
|
|
<Auth />
|
|
)}
|
|
</View>
|
|
);
|
|
}
|