import React, { useState } from 'react' import { Auth, ThemeSupa } from '@supabase/auth-ui-react' import JSONInput from 'react-json-editor-ajrm' import locale from 'react-json-editor-ajrm/locale/en' import { supabase } from './utils/supabaseClient' import { functionsList } from './functionsList' const sampleObject = { name: 'world' } function App() { const { user } = Auth.useUser() const [supaFunction, setSupaFunction] = useState(functionsList[0]) const [requestJson, setRequestJson] = useState(sampleObject) const [responseJson, setResponseJson] = useState({}) const invokeFunction = async () => { setResponseJson({ loading: true }) const { data, error } = await supabase.functions.invoke(supaFunction, { body: JSON.stringify(requestJson), }) if (error) alert(error) setResponseJson(data) } return (

Supabase Egde Functions Test Client

Request

Function

Note: when using locally, this selection doesn't have any effect and the function that's currently being served via the CLI is called instead.

Body

setRequestJson(jsObject)} placeholder={sampleObject} locale={locale} height="100" width="100%" />

Response

{JSON.stringify(responseJson, null, 2)}

Log in to see RLS in action

{user ? (

{`Logged in as ${user.email}`}

) : ( )}
) } export default App