fix: swagger bug in dev mode (#291)

Signed-off-by: sh1luo <690898835@qq.com>
This commit is contained in:
sh1luo 2021-09-12 12:09:44 +08:00 committed by GitHub
parent c70c62f52e
commit 52d9017611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -350,7 +350,7 @@ class App extends Component {
res.push( res.push(
<Menu.Item key="/swagger"> <Menu.Item key="/swagger">
<a target="_blank" rel="noreferrer" href={"/swagger"}> <a target="_blank" rel="noreferrer" href={Setting.isLocalhost ? `${Setting.ServerUrl}/swagger` : "/swagger"}>
{i18next.t("general:Swagger")} {i18next.t("general:Swagger")}
</a> </a>
</Menu.Item> </Menu.Item>

View File

@ -43,7 +43,7 @@ export function initServerUrl() {
} }
} }
function isLocalhost() { export function isLocalhost() {
const hostname = window.location.hostname; const hostname = window.location.hostname;
return hostname === "localhost"; return hostname === "localhost";
} }