mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 19:32:07 +00:00
Fix Scalar ApiClient routing (#2561)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-openapi': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed scalar api client routing
|
||||||
@@ -119,7 +119,7 @@ export function OpenAPICodeSample(props: {
|
|||||||
tabs={samples}
|
tabs={samples}
|
||||||
overlay={
|
overlay={
|
||||||
data['x-hideTryItPanel'] || data.operation['x-hideTryItPanel'] ? null : (
|
data['x-hideTryItPanel'] || data.operation['x-hideTryItPanel'] ? null : (
|
||||||
<ScalarApiButton />
|
<ScalarApiButton method={data.method} path={data.path} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import React from 'react';
|
|||||||
/**
|
/**
|
||||||
* Button which launches the Scalar API Client
|
* Button which launches the Scalar API Client
|
||||||
*/
|
*/
|
||||||
export function ScalarApiButton() {
|
export function ScalarApiButton({ method, path }: { method: string; path: string }) {
|
||||||
const client = useApiClientModal();
|
const client = useApiClientModal();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="scalar scalar-activate">
|
<div className="scalar scalar-activate">
|
||||||
<button className="scalar-activate-button" onClick={() => client?.open()}>
|
<button
|
||||||
|
className="scalar-activate-button"
|
||||||
|
onClick={() => client?.open({ method, path })}
|
||||||
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" fill="none">
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" fill="none">
|
||||||
<path
|
<path
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
Reference in New Issue
Block a user