import { useParams } from 'common' import { Button, IconCopy, Input } from 'ui' import { useProjectApiQuery } from 'data/config/project-api-query' import ContentSnippet from '../ContentSnippet' import { DOCS_CONTENT } from '../ProjectAPIDocs.constants' import { ContentProps } from './Content.types' import { copyToClipboard } from 'lib/helpers' import { useEffect, useState } from 'react' const Introduction = ({ showKeys, language, apikey, endpoint }: ContentProps) => { const { ref } = useParams() const { data } = useProjectApiQuery({ projectRef: ref }) const [copied, setCopied] = useState<'anon' | 'service'>() useEffect(() => { if (copied !== undefined) setTimeout(() => setCopied(undefined), 2000) }, [copied]) const serviceKey = showKeys ? data?.autoApiService.serviceApiKey ?? 'SUPABASE_CLIENT_SERVICE_KEY' : 'SUPABASE_CLIENT_SERVICE_KEY' return ( <>

Project URL

Client API key

} onClick={() => { setCopied('anon') copyToClipboard( data?.autoApiService.defaultApiKey ?? 'SUPABASE_CLIENT_ANON_KEY' ) }} > {copied === 'anon' ? 'Copied' : 'Copy'} , ]} />

Service key

This key has the ability to bypass Row Level Security.{' '} Never share it publicly.

} actions={[ , ]} />
) } export default Introduction