mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-01 00:07:32 +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> { | ||||
|   render() { | ||||
|     const { type, flow } = this.props; | ||||
|     const scopesNames = Object.keys(flow?.scopes || {}); | ||||
|     return ( | ||||
|       <tr> | ||||
|         <th> {type} OAuth Flow </th> | ||||
|  | @ -45,16 +46,21 @@ export class OAuthFlow extends React.PureComponent<OAuthFlowProps> { | |||
|               {flow!.refreshUrl} | ||||
|             </div> | ||||
|           )} | ||||
|           {!!scopesNames.length && ( | ||||
|             <> | ||||
|               <div> | ||||
|                 <strong> Scopes: </strong> | ||||
|               </div> | ||||
|               <ul> | ||||
|             {Object.keys(flow!.scopes || {}).map(scope => ( | ||||
|                 {scopesNames.map(scope => ( | ||||
|                   <li key={scope}> | ||||
|                 <code>{scope}</code> - <Markdown inline={true} source={flow!.scopes[scope] || ''} /> | ||||
|                     <code>{scope}</code> -{' '} | ||||
|                     <Markdown inline={true} source={flow!.scopes[scope] || ''} /> | ||||
|                   </li> | ||||
|                 ))} | ||||
|               </ul> | ||||
|             </> | ||||
|           )} | ||||
|         </td> | ||||
|       </tr> | ||||
|     ); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user