From ddd21915c81126941fa984116dd725b59402db4f Mon Sep 17 00:00:00 2001 From: rchrist Date: Thu, 18 Apr 2019 18:04:40 +0200 Subject: [PATCH] added first error dialogs w/o any error specification --- frontend/src/pages/Cache.vue | 6 +++--- frontend/src/pages/Overview.vue | 12 +++++++++--- frontend/src/pages/Profile.vue | 4 +++- frontend/src/pages/StationView.vue | 8 ++++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/Cache.vue b/frontend/src/pages/Cache.vue index b89af32..a339e36 100644 --- a/frontend/src/pages/Cache.vue +++ b/frontend/src/pages/Cache.vue @@ -159,9 +159,9 @@ console.log("POST api/createCache: " + response.statusText); this.$store.commit('cacheCollector/RESET_NEW_CACHE'); this.$router.push({ path: '/overview' }); - }) - .catch((error) => { - }); + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }); } else { // TODO update existing Cache } diff --git a/frontend/src/pages/Overview.vue b/frontend/src/pages/Overview.vue index 1616f18..7344d27 100644 --- a/frontend/src/pages/Overview.vue +++ b/frontend/src/pages/Overview.vue @@ -117,7 +117,9 @@ .then((response) => { console.log("Caches: " + this.caches); this.caches = response.data; - }) + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }) }, addCache() { this.$router.push({path: `/cache`}) @@ -129,7 +131,9 @@ this.$axios.delete('/api/deleteCache', {params: {cacheID: id}}) .then((response) => { this.fetchAllCaches() - }) + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }) }, startCache(cacheID) { const userToken = JSON.parse(localStorage.getItem('userToken')).token; @@ -147,7 +151,9 @@ console.log(stationID); //this.$router.push({path: `/station/${stationID}`}) this.$router.push({path: `/station/${cacheID}/${stationID}`}) - }) + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }) } } } diff --git a/frontend/src/pages/Profile.vue b/frontend/src/pages/Profile.vue index 9b13749..735b67d 100644 --- a/frontend/src/pages/Profile.vue +++ b/frontend/src/pages/Profile.vue @@ -127,7 +127,9 @@ this.$axios.get('/api/getMyCaches', { params: {token}} ) .then((response) => { this.startedCaches = response.data; - }); + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }); }, continueCache(cacheID) { } diff --git a/frontend/src/pages/StationView.vue b/frontend/src/pages/StationView.vue index 8b13337..7245dbb 100644 --- a/frontend/src/pages/StationView.vue +++ b/frontend/src/pages/StationView.vue @@ -85,8 +85,12 @@ const stationView = response.data.find(station => station.id === Number(this.$route.params.id)); console.log(JSON.stringify(stationView)); this.data.station = stationView; - }); - }); + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }); + }).catch((error) => { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error }) + }); } } }