Mercurial > gemma
changeset 1442:82117b22346c
merge
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Fri, 30 Nov 2018 13:10:46 +0100 |
parents | a4554e942954 (current diff) b3920ac3b2fd (diff) |
children | 6b100f639178 |
files | |
diffstat | 1 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/store/fairway.js Fri Nov 30 13:09:40 2018 +0100 +++ b/client/src/store/fairway.js Fri Nov 30 13:10:46 2018 +0100 @@ -140,20 +140,29 @@ headers: { "X-Gemma-Auth": localStorage.getItem("token") } }) .then(response => { - commit("profileLoaded", { - response: response, - surveyDate: survey.date_info - }); - resolve(response); + if (response.data.geometry.coordinates.length) { + commit("profileLoaded", { + response: response, + surveyDate: survey.date_info + }); + resolve(response); + } else { + commit("clearCurrentProfile"); + commit("application/showSplitscreen", false, { root: true }); + reject({ + response: { + status: null, + data: "No intersection with sounding data." + } + }); + } }) - .catch(error => { - reject(error); - }); + .catch(error => reject(error)); }); } }, cut({ commit, dispatch, rootState, rootGetters }, cut) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { const length = getLength(cut.getGeometry()); commit( "map/setCurrentMeasurement", @@ -211,6 +220,7 @@ DEMODATA ); commit("setFairwayCoordinates", fairwayCoordinates); + commit("application/showSplitscreen", true, { root: true }); resolve(); } ); @@ -219,15 +229,13 @@ const { status, data } = error.response; displayError({ title: "Backend Error", - message: `${status}: ${data.message || data}` + message: `${status ? status + ":" : ""} ${data.message || data}` }); - reject(); }) .finally(() => { - commit("application/showSplitscreen", true, { root: true }); commit("profileLoading", false); }); - } else reject(); + } }); }, previousCuts({ commit, rootState }) {