Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle promise rejections #4983

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions static/js/containers/DashboardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,18 @@ class DashboardPage extends React.Component {
fetchDashboard() {
const { dashboard, dispatch } = this.props
if (dashboard.fetchStatus === undefined) {
dispatch(fetchDashboard(SETTINGS.user.username))
dispatch(fetchDashboard(SETTINGS.user.username)).catch(() => {
/* Promise rejected */
})
}
}

fetchCoursePrices() {
const { prices, dispatch } = this.props
if (prices.getStatus === undefined) {
dispatch(actions.prices.get(SETTINGS.user.username))
dispatch(actions.prices.get(SETTINGS.user.username)).catch(() => {
/* Promise rejected */
})
}
}

Expand All @@ -317,14 +321,18 @@ class DashboardPage extends React.Component {
program !== undefined &&
R.pathEq([program.id, "getStatus"], undefined, programLearners)
) {
dispatch(actions.programLearners.get(program.id))
dispatch(actions.programLearners.get(program.id)).catch(() => {
/* Promise rejected */
})
}
}

fetchCoupons() {
const { coupons, dispatch } = this.props
if (coupons.fetchGetStatus === undefined) {
dispatch(fetchCoupons())
dispatch(fetchCoupons()).catch(() => {
/* Promise rejected */
})
}
}

Expand Down Expand Up @@ -378,7 +386,9 @@ class DashboardPage extends React.Component {
!discussionsFrontpage.loaded &&
!discussionsFrontpage.processing
) {
dispatch(actions.discussionsFrontpage.get())
dispatch(actions.discussionsFrontpage.get()).catch(() => {
/* Promise rejected */
})
}
}

Expand Down