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