Uncaught TypeError: Cannot read property 'then' of undefined
at HTMLElement.<anonymous> (FriendlyEats.View.js:164)
at MDCDialog.emit (material-components-web.js:347)
at Object.notifyAccept (material-components-web.js:7652)
at MDCDialogFoundation.accept (material-components-web.js:7848)
at MDCDialogFoundation.handleDialogClick_ (material-components-web.js:7868)
at HTMLDivElement.MDCDialogFoundation._this.dialogClickHandler_ (material-components-web.js:7786)
FriendlyEats.prototype.initReviewDialog = function() {
var dialog = document.querySelector('#dialog-add-review');
this.dialogs.add_review = new mdc.dialog.MDCDialog(dialog);
var that = this;
this.dialogs.add_review.listen('MDCDialog:accept', function() {
var pathname = that.getCleanPath(document.location.pathname);
var id = pathname.split('/')[2];
that.addRating(id, {
rating: rating,
text: dialog.querySelector('#text').value,
userName: 'Anonymous (Web)',
timestamp: new Date(),
userId: firebase.auth().currentUser.uid
}).then(function() {
that.rerender();
});
});
FriendlyEats.prototype.addRating = function(restaurantID, rating) {
/*
TODO: Retrieve add a rating to a restaurant
*/
};
If I missed the step for adding this implementation I apologize in advance. Any help would be greatly appreciated.