From a31e55ed5939588c413c9d9c76f2ebf378dcdbc7 Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Fri, 29 Apr 2022 14:18:23 +0300 Subject: [PATCH] fix: not show scopes if keys empty or not exist --- .../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} -{' '} + +
  • + ))} +
+ + )} );