Skip to content

Commit

Permalink
Merge pull request dandiflower#49 from dandiflower/jessica
Browse files Browse the repository at this point in the history
not crashing anymore still logging data...
  • Loading branch information
dandiflower committed Jul 13, 2018
2 parents a544148 + a6c2d3d commit 27728da
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
27 changes: 15 additions & 12 deletions client/src/components/Quiz/QuestionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "./Form.css";


class QuestionForm extends React.Component {

state = {
userId: ""
};
Expand Down Expand Up @@ -61,7 +62,7 @@ class QuestionForm extends React.Component {
if (response.data === true) {
this.setState({ persons: response.data });

// // window.location.pathname = "/results"
window.location.pathname = "/results"
// this.props.history.push(`/person/results/${userId}` )
}
})
Expand All @@ -76,8 +77,9 @@ class QuestionForm extends React.Component {
// is the user authorized????
componentDidMount() {
this.getUserID()
this.getSlideVal = this.getSlideVal.bind(this);
// setTimeout(() => {
console.log(this.state.userId);
// console.log(this.state.userId);
// }, 100);
axios.defaults.headers.common['Authorization'] = localStorage.getItem('jwtToken');
axios.get('/api/person')
Expand Down Expand Up @@ -143,16 +145,6 @@ class QuestionForm extends React.Component {
<div className="row">
<div className="col-md-12">
<form>
<p>
{localStorage.getItem('jwtToken') &&
<button
className="btn btn-primary"
onClick={this.logout}>
Logout
</button>
}
</p>


<p>First name: </p>
<Input
Expand Down Expand Up @@ -426,6 +418,17 @@ class QuestionForm extends React.Component {
Submit
</FormBtn>
<br /> <br />

<p>
{localStorage.getItem('jwtToken') &&
<button
className="btn btn-primary"
onClick={this.logout}>
Logout
</button>
}
</p>

</form>

</div>
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Results/Results.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
} */

#results--card--center {
position: fixed;
/* position: fixed; */
height: 4000px;
margin-bottom: -200px;
margin-left: 5%;
width: 90%;
Expand Down
17 changes: 17 additions & 0 deletions client/src/components/Results/Results.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import axios from 'axios';
import Navbar from "../Navbar/Navbar";
import HELPERS from "../../utils/helpers.js";
import "./Results.css";
Expand Down Expand Up @@ -29,6 +30,22 @@ getChartData() {
});
}

// is the user authorized????
componentDidMount() {

axios.defaults.headers.common['Authorization'] = localStorage.getItem('jwtToken');
axios.get('/api/person')
.then(res => {
this.setState({ persons: res.data });
console.log("this.state.persons", this.state.persons);
this.props.history.push()
})
.catch((error) => {
if (error.response.status === 401) {
this.props.history.push("/login");
}
});
}

logout() {
localStorage.removeItem('jwtToken');
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/Slidebar/Slidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ class CustomizedSlider extends React.Component {
sliderValue: value
})
// console.log("value", value)
this.props.onChange(this.props.id, this.state.sliderValue);


// THIS CODE IS THROWING ERROR ....
// this.props.onChange(this.props.id, this.state.sliderValue);


// return this.props.sliderValues(this.state.sliderValue)


Expand Down

0 comments on commit 27728da

Please sign in to comment.