Skip to content

Commit 5c3a356

Browse files
committed
add versions show on pages
1 parent be7f313 commit 5c3a356

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

pages/_app.js

+21-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Menu, Transition } from "@headlessui/react"
88
import { Fragment, useEffect, useRef } from "react"
99
import { ChevronDownIcon } from "@heroicons/react/solid"
1010
import { useRouter } from "next/router"
11+
import axios from "axios"
1112

1213
// On production, you should use something like web3Modal
1314
// to support additional wallet providers, like WalletConnect
@@ -18,6 +19,7 @@ function Marketplace({ Component, pageProps }) {
1819
const [ethAccount, setethAccount] = useState(null)
1920
const [Logined, setLogined] = useState(false)
2021
const [loadingState, setLoadingState] = useState("not-loaded")
22+
const [BackendVersion, setBackendVersion] = useState("err")
2123

2224
useEffect(() => {
2325
if (typeof window !== "undefined") {
@@ -42,9 +44,22 @@ function Marketplace({ Component, pageProps }) {
4244
})
4345
}
4446
listenMMAccount()
47+
getBackendVersion()
4548
}
4649
}, [])
4750

51+
async function getBackendVersion() {
52+
try {
53+
const dweb_search_ver_api = "https://dweb-search-api.anwen.cc/version"
54+
const ret = await axios.get(dweb_search_ver_api)
55+
if (ret.status == 200 && 'version' in ret.data) {
56+
setBackendVersion(ret.data['version'])
57+
}
58+
} catch (error) {
59+
console.log(error)
60+
}
61+
}
62+
4863
async function loginSig() {
4964
// change network and sig login
5065
const sig_login = localStorage.getItem("sig_login")
@@ -267,10 +282,13 @@ function Marketplace({ Component, pageProps }) {
267282

268283
<Component {...pageProps} />
269284

270-
271-
272285
<footer className="border-b p-6">
273-
<p>Version v0.4.4 Powered by Dweb Lab</p>
286+
<p>Frontend Version: v0.4.4 &nbsp;
287+
Backend Version: {BackendVersion} &nbsp;
288+
& <a href="https://mumbai.polygonscan.com/">Polygon (MATIC) Mumbai TESTNET</a>
289+
290+
&nbsp;| Powered by Dweb Lab.
291+
</p>
274292
</footer>
275293

276294
</div>

0 commit comments

Comments
 (0)