Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/large-months-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gitbook/react-openapi': patch
---

Fixed scalar api client routing
2 changes: 1 addition & 1 deletion packages/react-openapi/src/OpenAPICodeSample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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} />
)
}
/>
Expand Down
7 changes: 5 additions & 2 deletions packages/react-openapi/src/ScalarApiButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading