From 4eb136c2497bc42988efe245073e41ad1c96cc84 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sat, 29 Jan 2022 12:17:30 -0800 Subject: [PATCH] Store token in App.js state, show temporarily in profile --- frontend/src/components/App.js | 3 ++- frontend/src/components/BottomBar.js | 26 ++++++++++++++++++++++---- frontend/src/components/UserGenPage.js | 1 + 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/App.js b/frontend/src/components/App.js index b07b8b20..4186be22 100644 --- a/frontend/src/components/App.js +++ b/frontend/src/components/App.js @@ -9,6 +9,7 @@ export default class App extends Component { super(props); this.state = { nickname: null, + token: null, } } @@ -23,7 +24,7 @@ export default class App extends Component {
- +
); diff --git a/frontend/src/components/BottomBar.js b/frontend/src/components/BottomBar.js index 5dbbce8a..3d1b2ec9 100644 --- a/frontend/src/components/BottomBar.js +++ b/frontend/src/components/BottomBar.js @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import {Badge, ListItemAvatar, Avatar,Paper, Grid, IconButton, Typography, Select, MenuItem, List, ListItemText, ListItem, ListItemIcon, ListItemButton, Divider, Dialog, DialogContent} from "@mui/material"; +import {Badge, TextField, ListItemAvatar, Avatar,Paper, Grid, IconButton, Typography, Select, MenuItem, List, ListItemText, ListItem, ListItemIcon, ListItemButton, Divider, Dialog, DialogContent} from "@mui/material"; import MediaQuery from 'react-responsive' // Icons @@ -16,6 +16,7 @@ import EqualizerIcon from '@mui/icons-material/Equalizer'; import SendIcon from '@mui/icons-material/Send'; import PublicIcon from '@mui/icons-material/Public'; import NumbersIcon from '@mui/icons-material/Numbers'; +import PasswordIcon from '@mui/icons-material/Password'; // pretty numbers function pn(x) { @@ -191,7 +192,7 @@ export default class BottomBar extends Component { - + {this.props.nickname ? "⚡"+this.props.nickname+"⚡" : ""} @@ -211,14 +212,31 @@ export default class BottomBar extends Component { - + : - + } + + + + + + {this.props.token ? + + : + 'Cannot remember'} + + + diff --git a/frontend/src/components/UserGenPage.js b/frontend/src/components/UserGenPage.js index b5f58781..4a42a5c6 100644 --- a/frontend/src/components/UserGenPage.js +++ b/frontend/src/components/UserGenPage.js @@ -61,6 +61,7 @@ export default class UserGenPage extends Component { & this.props.setAppState({ nickname: data.nickname, + token: this.state.token, }); }); }