aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-02-08 15:41:18 +0100
committerlonkaars <l.leblansch@gmail.com>2021-02-08 15:41:18 +0100
commit813e3dd1298776b0f0c178af44edf122d75d5a39 (patch)
tree2271aed1cf08d653673052465af0ca2b1ff13bd8 /pages
parentfb1f80d5af7e3808a3506ee5d2b609394f452cec (diff)
improved home page
Diffstat (limited to 'pages')
-rw-r--r--pages/index.tsx28
1 files changed, 8 insertions, 20 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index 665ef6a..aedd5cf 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -41,16 +41,6 @@ var SquareSize: CSSProperties = {
height: 90
}
-var LeftAlignedTableColumn: CSSProperties = {
- textAlign: "left",
- paddingLeft: 16
-}
-
-var RightAlignedTableColumn: CSSProperties = {
- textAlign: "right",
- paddingRight: 16
-}
-
export default class HomePage extends Component {
state: {
info: userInfo,
@@ -59,8 +49,14 @@ export default class HomePage extends Component {
info: {},
loggedIn: false
}
-
- getUserInfo () {
+
+ constructor(props: {}) {
+ super(props);
+
+ if (typeof window === "undefined") return; // return if run on server
+ this.state.loggedIn = document.cookie.includes("token");
+
+ if (this.state.loggedIn == false) return; // don't request user info if not logged in
axios.request<userInfo>({
method: "get",
url: `/api/user/info`,
@@ -68,14 +64,6 @@ export default class HomePage extends Component {
})
.then(request => this.setState({ info: request.data }))
.catch(() => {});
-
- if (typeof window === "undefined") return; // return if run on server
- this.state.loggedIn = document.cookie.includes("token");
- }
-
- constructor(props: {}) {
- super(props);
- this.getUserInfo();
}
render () {