mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +08:00
Correct the code examples for the Clerk third-party auth docs: - Fix TypeScript error - Change RLS policy check to accept both [Clerk v1 and v2 JWTs](https://clerk.com/docs/backend-requests/resources/session-tokens) Pulled code samples from an example app that I've checked in to make maintenance and testing easier in the future.
25 lines
545 B
TypeScript
25 lines
545 B
TypeScript
'use client'
|
|
|
|
import { useSupabaseClient } from '@/hooks/useSupabaseClient'
|
|
import { useEffect, useState } from 'react'
|
|
|
|
export function ReadData() {
|
|
const supabase = useSupabaseClient()
|
|
const [data, setData] = useState<Array<unknown>>([])
|
|
|
|
useEffect(() => {
|
|
supabase
|
|
.from('secured_table')
|
|
.select('*')
|
|
.then(({ data, error }) => {
|
|
if (error) {
|
|
console.error(error)
|
|
} else {
|
|
setData(data)
|
|
}
|
|
})
|
|
}, [supabase])
|
|
|
|
return <pre>{JSON.stringify(data, null, 2)}</pre>
|
|
}
|