Skip to content

Commit 77c847d

Browse files
committed
handle case where options are combined
1 parent 1f875bc commit 77c847d

File tree

1 file changed

+5
-1
lines changed
  • packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets

1 file changed

+5
-1
lines changed

packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,17 @@ function CodeSnippets({ postman, codeSamples }: Props) {
5454

5555
const auth = useTypedSelector((state: any) => state.auth);
5656
const clonedAuth = cloneDeep(auth);
57+
console.log(clonedAuth);
5758
let placeholder: string;
5859

5960
function cleanCredentials(obj: any) {
6061
for (const key in obj) {
6162
if (typeof obj[key] === "object" && obj[key] !== null) {
6263
// use name as placeholder if exists
63-
placeholder = clonedAuth?.options?.[key]?.[0]?.name;
64+
const comboAuthId = Object.keys(obj).join(" and ");
65+
const authOptions =
66+
clonedAuth?.options?.[key] ?? clonedAuth?.options?.[comboAuthId];
67+
placeholder = authOptions?.[0]?.name;
6468
obj[key] = cleanCredentials(obj[key]);
6569
} else {
6670
obj[key] = `<${placeholder ?? key}>`;

0 commit comments

Comments
 (0)