Fix broken chained catch in Promises

This commit is contained in:
Lucas Verney 2018-08-02 10:49:47 +02:00
parent 530184a817
commit bb926abbc4
3 changed files with 10 additions and 4 deletions

View File

@ -29,7 +29,10 @@ export function fetchReports({ commit }) {
commit(STORE_REPORTS, { reports }); commit(STORE_REPORTS, { reports });
commit(IS_DONE_LOADING); commit(IS_DONE_LOADING);
}) })
.catch(() => commit(IS_DONE_LOADING)); .catch((exc) => {
commit(IS_DONE_LOADING);
throw exc;
});
} }
export function downvote({ commit }, { id }) { export function downvote({ commit }, { id }) {
@ -53,7 +56,10 @@ export function saveReport({ commit }, { type, lat, lng }) {
commit(PUSH_REPORT, { report }); commit(PUSH_REPORT, { report });
commit(IS_DONE_LOADING); commit(IS_DONE_LOADING);
}) })
.catch(() => commit(IS_DONE_LOADING)); .catch((exc) => {
commit(IS_DONE_LOADING);
throw exc;
});
} }
export function saveUnsentReport({ commit }, { report }) { export function saveUnsentReport({ commit }, { report }) {

View File

@ -243,7 +243,7 @@ export default {
this.$store.state.location.error = 1; this.$store.state.location.error = 1;
} }
} }
this.$store.dispatch('fetchReports'); this.$store.dispatch('fetchReports').catch(() => {});
}, },
}; };
</script> </script>

View File

@ -67,7 +67,7 @@ export default {
goToMap() { goToMap() {
// Eventually vibrate, to ensure permission is prompted before driving // Eventually vibrate, to ensure permission is prompted before driving
if (this.$store.state.settings.hasVibratePermission && navigator.vibrate) { if (this.$store.state.settings.hasVibratePermission && navigator.vibrate) {
navigator.vibrate(1); navigator.vibrate(100);
} }
if (!this.$store.state.settings.skipOnboarding) { if (!this.$store.state.settings.skipOnboarding) {