app.component('review-form', { template: `
`, data() { return { name: '', review: '', rating: null } }, methods: { onSubmit() { if (this.name == '' || this.review == '' || this.rating == null) { alert("Review is incomplete. Please fill out every field.") return } let productReview = { name: this.name, review: this.review, rating: this.rating } this.addReview(productReview) this.name = '' this.review = '' this.rating = null }, addReview(review){ // TODO: Append review to json axios.post('./reviews.json', JSON.stringify(review)) } } })