Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav committed Jan 17, 2025
1 parent 02c4f61 commit 188e754
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions frontend/public/src/components/CourseProductDetailEnroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,19 @@ export class CourseProductDetailEnroll extends React.Component<
async onAddToCartClick() {
const { addToCart } = this.props
const run = this.getCurrentCourseRun()
const product = run && run.products ? run.products[0] : null
const addToCartResponse = await addToCart(product.id)
this.setState({
upgradeEnrollmentDialogVisibility: false
})
if (isSuccessResponse(addToCartResponse)) {
if (run && run.products) {
const product = run.products[0]
const addToCartResponse = await addToCart(product.id)
this.setState({
addedToCartDialogVisibility: true
upgradeEnrollmentDialogVisibility: false
})
} else {
// set notification something went wrong
if (isSuccessResponse(addToCartResponse)) {
this.setState({
addedToCartDialogVisibility: true
})
} else {
// set notification something went wrong
}
}
}

Expand Down

0 comments on commit 188e754

Please sign in to comment.