mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +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}
|
||||
overlay={
|
||||
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
|
||||
*/
|
||||
export function ScalarApiButton() {
|
||||
export function ScalarApiButton({ method, path }: { method: string; path: string }) {
|
||||
const client = useApiClientModal();
|
||||
|
||||
return (
|
||||
<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">
|
||||
<path
|
||||
stroke="currentColor"
|
||||
|
||||
Reference in New Issue
Block a user