This is an automated email from the ASF dual-hosted git repository.
urfree pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push:
new 104c363 update
104c363 is described below
commit 104c363ba5dea664743b31bfc2d13fed5f42a50c
Author: LiLi <[email protected]>
AuthorDate: Mon Jan 24 19:21:01 2022 +0800
update
Signed-off-by: LiLi <[email protected]>
---
site2/website-next/src/components/RestApi.js | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/site2/website-next/src/components/RestApi.js
b/site2/website-next/src/components/RestApi.js
index e2e5289..b9ad21b 100644
--- a/site2/website-next/src/components/RestApi.js
+++ b/site2/website-next/src/components/RestApi.js
@@ -2,7 +2,7 @@ const React = require("react");
import Layout from "@theme/Layout";
import { setVersion, getVersion, getApiVersion } from "../utils/index.js";
-function parseVersion() {
+function parseVersion(pathName) {
let swagger = "swagger";
if (pathName.indexOf("functions") > -1) {
swagger = "swaggerfunctions";
@@ -31,17 +31,18 @@ function parseVersion() {
}
class RestApi extends React.Component {
componentDidMount() {
- let [version, apiversion] = parseVersion();
+ let pathName = window.location.pathname;
- var pathName = window.location.pathname;
- var params = window.location.search;
+ let [version, apiversion] = parseVersion(pathName);
+
+ let params = window.location.search;
params = params.replace("?", "");
const paramsList = params.split("&");
if (paramsList && paramsList.length > 0) {
version = "master";
apiversion = "";
- for (var i in paramsList) {
- var param = paramsList[i].split("=");
+ for (let i; in paramsList) {
+ let param = paramsList[i].split("=");
if (param[0] === "version") {
version = param[1];
}