Skip to content
This repository was archived by the owner on Sep 16, 2019. It is now read-only.

Commit 2604fa9

Browse files
committed
Critical bugfix for review form submission, fixed avg star text
handleSubmit was not bound to `this`, resulting in no context being passed.
1 parent b01d505 commit 2604fa9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/CourseInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default class CourseInfo extends Component {
7373
const courseRef = firebase.database().ref().child('courses').child(this.course);
7474
courseRef.on('value', (data) => {
7575
// const dataValue = data.val();
76-
// console.log("GOT", data);
76+
data = data.val();
7777
const reviewAverage = data.totalStars / data.totalReviews;
7878
if (Number.isNaN(reviewAverage)) {
7979
that.averageStars = 'No reviews yet.';

src/ReviewForm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class ReviewForm extends Component {
1515
constructor(props) {
1616
super(props);
1717
console.log(props);
18-
this.handleSubmit.bind(this);
18+
this.handleSubmit = this.handleSubmit.bind(this);
1919
this.state_props = props;
2020
this.course = this.state_props.course;
2121
this.submitted = undefined;
@@ -33,7 +33,7 @@ export default class ReviewForm extends Component {
3333

3434
handleSubmit(event) {
3535
event.preventDefault();
36-
const that = this;
36+
var that = this;
3737
firebase.auth().onAuthStateChanged((user) => {
3838
if (user) {
3939
const displayName = user.displayName;

0 commit comments

Comments
 (0)