mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-18 10:50:32 +03:00
parent
a69c402d9b
commit
b5f32247be
|
@ -4,6 +4,7 @@ import { OperationModel } from '../../services';
|
||||||
import { OptionsContext } from '../OptionsProvider';
|
import { OptionsContext } from '../OptionsProvider';
|
||||||
import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
|
import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
|
||||||
|
|
||||||
|
import { getBasePath } from '../../utils';
|
||||||
import {
|
import {
|
||||||
EndpointInfo,
|
EndpointInfo,
|
||||||
HttpVerb,
|
HttpVerb,
|
||||||
|
@ -63,7 +64,11 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
|
||||||
<div>{server.description}</div>
|
<div>{server.description}</div>
|
||||||
<SelectOnClick>
|
<SelectOnClick>
|
||||||
<ServerUrl>
|
<ServerUrl>
|
||||||
{!(hideHostname || options.hideHostname) && <span>{server.url}</span>}
|
<span>
|
||||||
|
{hideHostname || options.hideHostname
|
||||||
|
? getBasePath(server.url)
|
||||||
|
: server.url}
|
||||||
|
</span>
|
||||||
{operation.path}
|
{operation.path}
|
||||||
</ServerUrl>
|
</ServerUrl>
|
||||||
</SelectOnClick>
|
</SelectOnClick>
|
||||||
|
|
|
@ -161,3 +161,7 @@ export function resolveUrl(url: string, to: string) {
|
||||||
}
|
}
|
||||||
return stripTrailingSlash(res);
|
return stripTrailingSlash(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBasePath(serverUrl: string): string {
|
||||||
|
return new URL(serverUrl).pathname;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user