fix: remove duplicated slash if hideHostname option enabled

This commit is contained in:
Anya Stasiuk 2020-11-03 12:56:55 +02:00
parent 4567534cbb
commit 36deecacfd

View File

@ -67,6 +67,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
const normalizedUrl = options.expandDefaultServerVariables const normalizedUrl = options.expandDefaultServerVariables
? expandDefaultServerVariables(server.url, server.variables) ? expandDefaultServerVariables(server.url, server.variables)
: server.url; : server.url;
const basePath = getBasePath(normalizedUrl) === '/' ? '' : getBasePath(normalizedUrl);
return ( return (
<ServerItem key={normalizedUrl}> <ServerItem key={normalizedUrl}>
<Markdown source={server.description || ''} compact={true} /> <Markdown source={server.description || ''} compact={true} />
@ -74,7 +75,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
<ServerUrl> <ServerUrl>
<span> <span>
{hideHostname || options.hideHostname {hideHostname || options.hideHostname
? getBasePath(normalizedUrl) ? basePath
: normalizedUrl} : normalizedUrl}
</span> </span>
{operation.path} {operation.path}