ChatAI / static /app.jsx
Tabatha-625's picture
Update static/app.jsx
c74af9c verified
Raw History Blame Contribute Delete
472 Bytes
function App() {
const [session, setSession] = React.useState(null);
const [loading, setLoading] = React.useState(true);
React.useEffect(() => {
supabase.auth.getSession().then(({ data }) => {
setSession(data.session);
setLoading(false);
});
supabase.auth.onAuthStateChange((_event, session) => {
setSession(session);
});
}, []);
if (loading) return null;
if (!session) {
return <Login />;
}
return <ChatUI />;
}