mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03:00
feat(hooks): update default edge function url (#18186)
This commit is contained in:
1 parent
cde1731b43
commit
90ae844a0b
3 files changed
+6
-4
No files matched your search
@@ -96,7 +96,8 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
|
||||
const restUrlTld = new URL(restUrl as string).hostname.split('.').pop()
|
||||
|
||||
const isEdgeFunction = (url: string) =>
|
||||
url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`)
|
||||
url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`) ||
|
||||
url.includes(`https://${ref}.supabase.${restUrlTld}/functions/`)
|
||||
|
||||
const initialValues = {
|
||||
name: selectedHook?.name ?? '',
|
||||
@@ -397,7 +398,7 @@ const FormContents = ({
|
||||
}
|
||||
} else if (values.function_type === 'supabase_function') {
|
||||
const fnSlug = (functions ?? [])[0]?.slug
|
||||
const defaultFunctionUrl = `https://${projectRef}.functions.supabase.${restUrlTld}/${fnSlug}`
|
||||
const defaultFunctionUrl = `https://${projectRef}.supabase.${restUrlTld}/functions/v1/${fnSlug}`
|
||||
const updatedValues = {
|
||||
...values,
|
||||
http_url: isEdgeFunction(values.http_url) ? values.http_url : defaultFunctionUrl,
|
||||
|
||||
@@ -107,7 +107,7 @@ const HTTPRequestFields = ({
|
||||
{edgeFunctions.map((fn) => {
|
||||
const restUrl = selectedProject?.restUrl
|
||||
const restUrlTld = new URL(restUrl as string).hostname.split('.').pop()
|
||||
const functionUrl = `https://${ref}.functions.supabase.${restUrlTld}/${fn.slug}`
|
||||
const functionUrl = `https://${ref}.supabase.${restUrlTld}/functions/v1/${fn.slug}`
|
||||
|
||||
return (
|
||||
<Listbox.Option key={fn.id} id={functionUrl} value={functionUrl} label={fn.name}>
|
||||
|
||||
@@ -52,7 +52,8 @@ const HookList = ({ schema, filterString, editHook = noop, deleteHook = noop }:
|
||||
<>
|
||||
{filteredHooks.map((x: any) => {
|
||||
const isEdgeFunction = (url: string) =>
|
||||
url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`)
|
||||
url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`) ||
|
||||
url.includes(`https://${ref}.supabase.${restUrlTld}/functions/`)
|
||||
const [url, method] = x.function_args
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user