mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-30 23:37:28 +03:00 
			
		
		
		
	fix: not show scopes if keys empty or not exist (#1975)
This commit is contained in:
		
							parent
							
								
									0fa08faab1
								
							
						
					
					
						commit
						4e793f07a8
					
				|  | @ -23,6 +23,7 @@ export interface OAuthFlowProps { | ||||||
| export class OAuthFlow extends React.PureComponent<OAuthFlowProps> { | export class OAuthFlow extends React.PureComponent<OAuthFlowProps> { | ||||||
|   render() { |   render() { | ||||||
|     const { type, flow } = this.props; |     const { type, flow } = this.props; | ||||||
|  |     const scopesNames = Object.keys(flow?.scopes || {}); | ||||||
|     return ( |     return ( | ||||||
|       <tr> |       <tr> | ||||||
|         <th> {type} OAuth Flow </th> |         <th> {type} OAuth Flow </th> | ||||||
|  | @ -45,16 +46,21 @@ export class OAuthFlow extends React.PureComponent<OAuthFlowProps> { | ||||||
|               {flow!.refreshUrl} |               {flow!.refreshUrl} | ||||||
|             </div> |             </div> | ||||||
|           )} |           )} | ||||||
|           <div> |           {!!scopesNames.length && ( | ||||||
|             <strong> Scopes: </strong> |             <> | ||||||
|           </div> |               <div> | ||||||
|           <ul> |                 <strong> Scopes: </strong> | ||||||
|             {Object.keys(flow!.scopes || {}).map(scope => ( |               </div> | ||||||
|               <li key={scope}> |               <ul> | ||||||
|                 <code>{scope}</code> - <Markdown inline={true} source={flow!.scopes[scope] || ''} /> |                 {scopesNames.map(scope => ( | ||||||
|               </li> |                   <li key={scope}> | ||||||
|             ))} |                     <code>{scope}</code> -{' '} | ||||||
|           </ul> |                     <Markdown inline={true} source={flow!.scopes[scope] || ''} /> | ||||||
|  |                   </li> | ||||||
|  |                 ))} | ||||||
|  |               </ul> | ||||||
|  |             </> | ||||||
|  |           )} | ||||||
|         </td> |         </td> | ||||||
|       </tr> |       </tr> | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user