Home / Function/ useApiUrlCommand() — supabase Function Reference

useApiUrlCommand() — supabase Function Reference

Architecture documentation for the useApiUrlCommand() function in ApiUrl.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  9c79d11a_a820_f4ea_7377_ede35f51376c["useApiUrlCommand()"]
  7902296a_39c1_2b01_0b22_d5c1b0ad688b["StudioCommandMenu()"]
  7902296a_39c1_2b01_0b22_d5c1b0ad688b -->|calls| 9c79d11a_a820_f4ea_7377_ede35f51376c
  style 9c79d11a_a820_f4ea_7377_ede35f51376c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx lines 15–53

export function useApiUrlCommand() {
  const setIsOpen = useSetCommandMenuOpen()
  const resetCommandMenu = useResetCommandMenu()

  const { data: project } = useSelectedProjectQuery()
  const { data: settings } = useProjectSettingsV2Query(
    { projectRef: project?.ref },
    { enabled: !!project }
  )

  const protocol = settings?.app_config?.protocol ?? 'https'
  const endpoint = settings?.app_config?.endpoint
  const apiUrl = endpoint ? `${protocol}://${endpoint}` : undefined

  useRegisterCommands(
    COMMAND_MENU_SECTIONS.ACTIONS,
    [
      {
        id: 'api-url',
        name: 'Copy API URL',
        action: () => {
          copyToClipboard(apiUrl ?? '', () => {
            toast.success('API URL copied to clipboard')
          })
          setIsOpen(false)
          resetCommandMenu()
        },
        icon: () => <Link />,
        badge: () => <Badge>Project: {project?.name}</Badge>,
      },
    ],
    {
      enabled: !!project,
      deps: [apiUrl, project],
      orderSection: orderCommandSectionsByPriority,
      sectionMeta: { priority: 3 },
    }
  )
}

Subdomains

Frequently Asked Questions

What does useApiUrlCommand() do?
useApiUrlCommand() is a function in the supabase codebase.
What calls useApiUrlCommand()?
useApiUrlCommand() is called by 1 function(s): StudioCommandMenu.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free