From e20642fe68a2659cfba3d40c5a318196d0721e85 Mon Sep 17 00:00:00 2001 From: Sanjeet Uppal Date: Fri, 27 Oct 2017 13:50:46 -0700 Subject: [PATCH] Modify allSecurities block within CodeSampleResponse --- .../src/CodeSampleResponse.jsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/api-explorer-ui/src/CodeSampleResponse.jsx b/packages/api-explorer-ui/src/CodeSampleResponse.jsx index b7ac77d1a..d9488ad1c 100644 --- a/packages/api-explorer-ui/src/CodeSampleResponse.jsx +++ b/packages/api-explorer-ui/src/CodeSampleResponse.jsx @@ -131,16 +131,23 @@ class CodeSampleResponse extends React.Component { {result.statusCode[0] === 401 && (
- {allSecurities && - (allSecurities.OAuth2[0].flows.implicit.authorizationUrl && -
-

Your OAuth2 token has expired

- - Reauthenticate via OAuth2 - -
(

Your OAuth2 token is incorrect or has expired

))( -

You couldn't be authenticated

, - )} + {allSecurities.OAuth2 ? ( + () => { + if (allSecurities.OAuth2[0].flows.implicit.authorizationUrl) { + return ( +
+

Your OAuth2 token has expired

+ + Reauthenticate via OAuth2 + +
+ ); + } + return

Your OAuth2 token is incorrect or has expired

; + } + ) : ( +

You couldn't be authenticated

+ )}
)}