From 152011d11e032a7297de855724d74da83fa6f1cb Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 25 Apr 2021 17:01:12 +0200 Subject: added version number from package.json and commit hash to footer --- components/footer.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'components/footer.tsx') diff --git a/components/footer.tsx b/components/footer.tsx index 8a1319e..575f7e9 100644 --- a/components/footer.tsx +++ b/components/footer.tsx @@ -1,5 +1,8 @@ -import { ReactNode } from 'react'; +import axios from 'axios'; +import { ReactNode, useEffect, useState } from 'react'; import * as cookie from 'react-cookies'; + +import { serverStatus } from '../api/api'; import Logo from '../components/logo'; import ExitToAppOutlinedIcon from '@material-ui/icons/ExitToAppOutlined'; @@ -25,11 +28,24 @@ function PageLink(props: { export function Footer() { var loggedIn = !!cookie.load('token'); + var [status, setStatus] = useState(); + + useEffect(() => { + axios.request({ + url: '/api/status', + }).then(res => { + setStatus(res.data); + }); + }, []); return
-
+

4 op een rij

+ + v{status?.version.number} + ({status?.version.commit.substr(0, 8)}) +
@@ -50,3 +66,6 @@ export function Footer() {
; } + +Footer.getInitialProps = async () => { +}; -- cgit v1.2.3