mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 01:10:15 -04:00
02aea98053
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
625 B
TypeScript
25 lines
625 B
TypeScript
'use client'
|
|
|
|
import { useSupabaseClient } from '@/hooks/useSupabaseClient'
|
|
import { useUser } from '@clerk/nextjs'
|
|
|
|
export function InsertData() {
|
|
const supabase = useSupabaseClient()
|
|
|
|
const { user } = useUser()
|
|
const organizationId = user?.organizationMemberships?.[0]?.organization?.id
|
|
|
|
async function onInsertRow() {
|
|
if (organizationId) {
|
|
const { error } = await supabase
|
|
.from('secured_table')
|
|
.insert({ organization_id: organizationId })
|
|
if (error) {
|
|
console.error(error)
|
|
}
|
|
}
|
|
}
|
|
|
|
return <button onClick={onInsertRow}>Insert row to protected table</button>
|
|
}
|