From a6d2b241af36c648a434b1a3816683021fda2b1e Mon Sep 17 00:00:00 2001 From: Paul Gamble Date: Mon, 29 Apr 2019 15:41:56 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20=20-=20moved=20components=20into?= =?UTF-8?q?=20this.state.habitExist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved the components into the this.state.habitExist; this of course breaks some logic. We're setting the habitExist based on clicking the button for the modal not the submission button. #94 --- client/src/components/Dashboard.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/client/src/components/Dashboard.js b/client/src/components/Dashboard.js index 041d67d..e2923b0 100644 --- a/client/src/components/Dashboard.js +++ b/client/src/components/Dashboard.js @@ -29,9 +29,7 @@ class Dashboard extends Component { componentDidUpdate(prevProps) { if (this.props.email !== undefined && this.props.email !== prevProps.email) { // Do what you want with email - const user = this.props.email - console.log("Dashboard - email is: " + user) - + const user = this.props.email axios.get('/api/habits/first-habit/' + user) .then(res => this.setState({ habitData: res.data.data }, () => { @@ -76,26 +74,27 @@ class Dashboard extends Component { render() { return (
- - - ; - -

Hello, {this.props.displayName}!

Have a habit? : {this.state.habitExist.toString()}

{this.state.habitExist && - +
+ + +
} {!this.state.habitExist && - +
+ + +
}

Daily Dashboard