From 4e793f07a81fa8bcd4ad384d1f87b3e6c290edb7 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Tue, 3 May 2022 11:25:46 +0300 Subject: [PATCH] fix: not show scopes if keys empty or not exist (#1975) --- .../SecuritySchemes/SecuritySchemes.tsx | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/components/SecuritySchemes/SecuritySchemes.tsx b/src/components/SecuritySchemes/SecuritySchemes.tsx index f23264bdf3..817b0666a0 100644 --- a/src/components/SecuritySchemes/SecuritySchemes.tsx +++ b/src/components/SecuritySchemes/SecuritySchemes.tsx @@ -23,6 +23,7 @@ export interface OAuthFlowProps { export class OAuthFlow extends React.PureComponent { render() { const { type, flow } = this.props; + const scopesNames = Object.keys(flow?.scopes || {}); return ( {type} OAuth Flow @@ -45,16 +46,21 @@ export class OAuthFlow extends React.PureComponent { {flow!.refreshUrl} )} -
- Scopes: -
-
    - {Object.keys(flow!.scopes || {}).map(scope => ( -
  • - {scope} - -
  • - ))} -
+ {!!scopesNames.length && ( + <> +
+ Scopes: +
+
    + {scopesNames.map(scope => ( +
  • + {scope} -{' '} + +
  • + ))} +
+ + )} );