From 21a2ef5b70b10e6ab992502c2231f20337951253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Tue, 18 Jul 2023 09:43:39 +0200 Subject: [PATCH] fix(swagger-ui-react): re-enable SSR support (#9035) SSR support was re-enabled by passing the oauth2RedirectUrl prop only when defined. Refs #8976 --- flavors/swagger-ui-react/index.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flavors/swagger-ui-react/index.jsx b/flavors/swagger-ui-react/index.jsx index 05a1aab86df..2f1b4ba54c1 100644 --- a/flavors/swagger-ui-react/index.jsx +++ b/flavors/swagger-ui-react/index.jsx @@ -37,7 +37,7 @@ export default class SwaggerUI extends React.Component { filter: this.props.filter, persistAuthorization: this.props.persistAuthorization, withCredentials: this.props.withCredentials, - oauth2RedirectUrl: this.props.oauth2RedirectUrl + ...(typeof this.props.oauth2RedirectUrl === "string" ? { oauth2RedirectUrl: this.props.oauth2RedirectUrl} : {}) }) this.system = ui @@ -166,7 +166,7 @@ SwaggerUI.defaultProps = { displayRequestDuration: false, withCredentials: undefined, persistAuthorization: false, - oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"))}/oauth2-redirect.html`, + oauth2RedirectUrl: undefined, } SwaggerUI.presets = swaggerUIConstructor.presets