docs: improve API testing feature (#7311)
This commit is contained in:
@@ -3,14 +3,13 @@
|
||||
import React, { useMemo, useState } from "react"
|
||||
import clsx from "clsx"
|
||||
import { HighlightProps, Highlight, themes } from "prism-react-renderer"
|
||||
import { CopyButton, Tooltip, Link } from "@/components"
|
||||
import { ApiRunner, CopyButton, Tooltip, Link } from "@/components"
|
||||
import { useColorMode } from "@/providers"
|
||||
import { ExclamationCircle, PlaySolid, SquareTwoStack } from "@medusajs/icons"
|
||||
import { CodeBlockHeader, CodeBlockHeaderMeta } from "./Header"
|
||||
import { CodeBlockLine } from "./Line"
|
||||
import { ApiAuthType, ApiDataOptions, ApiMethod } from "types"
|
||||
import { CSSTransition } from "react-transition-group"
|
||||
import { ApiRunner } from "./ApiRunner"
|
||||
import { GITHUB_ISSUES_PREFIX } from "../.."
|
||||
|
||||
export type Highlight = {
|
||||
@@ -69,7 +68,10 @@ export const CodeBlock = ({
|
||||
const { colorMode } = useColorMode()
|
||||
const [showTesting, setShowTesting] = useState(false)
|
||||
const canShowApiTesting = useMemo(
|
||||
() => apiTesting && rest.testApiMethod && rest.testApiUrl,
|
||||
() =>
|
||||
apiTesting !== undefined &&
|
||||
rest.testApiMethod !== undefined &&
|
||||
rest.testApiUrl !== undefined,
|
||||
[apiTesting, rest]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user