Files
7ce0038156 chore(docs): add dotenvx example (#31213)
* wip

* wip

* wip

* remove seeds

* wip

* add branching memento

* remove triple dots

* proofread

* chore: mention direct secret usage

* chore: update README.md

* chore: update docs

* fix: .env.local to .env.developemnt

* chore: fix typo

* chore: fix commands

* chore: update README.md

* chore: apply PR comments

* chore: rename .env.local to .env

* chore: simplify dotenvx setup (#32824)

* chore: bump cli

* chore: disable unused seed

---------

Co-authored-by: Han Qiao <sweatybridge@gmail.com>
Co-authored-by: Qiao Han <qiao@supabase.io>
2025-01-17 14:33:15 +08:00

43 lines
1.1 KiB
JavaScript

import { useState, useEffect } from 'react'
import { supabase } from 'lib/Store'
import { Auth } from '@supabase/auth-ui-react'
import { ThemeSupa } from '@supabase/auth-ui-shared'
const Home = () => {
const [session, setSession] = useState(null)
useEffect(() => {
supabase.auth.getSession().then(({ data: { session } }) => {
setSession(session)
})
const {
data: { subscription },
} = supabase.auth.onAuthStateChange((_event, session) => {
setSession(session)
})
return () => subscription.unsubscribe()
}, [])
if (!session) {
return (
<div className="w-full h-full flex justify-center items-center p-4 bg-gray-300">
<div className="w-full sm:w-1/2 xl:w-1/3">
<div className="border-teal p-8 border-t-12 bg-white mb-6 rounded-lg shadow-lg bg-white">
<Auth
supabaseClient={supabase}
appearance={{ theme: ThemeSupa }}
providers={['github']}
/>
</div>
</div>
</div>
)
} else {
return <div>Logged in!</div>
}
}
export default Home