# HG changeset patch # User Markus Kottlaender # Date 1543579756 -3600 # Node ID b3920ac3b2fd7f11911f6aa6a8835138f32649ca # Parent 71eb96690f9102582cdfa45dc27f000c88d77f4b fixed bug when drawing crowss profile outside of bottleneck diff -r 71eb96690f91 -r b3920ac3b2fd client/src/store/fairway.js --- a/client/src/store/fairway.js Fri Nov 30 11:12:47 2018 +0100 +++ b/client/src/store/fairway.js Fri Nov 30 13:09:16 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 }) {