From ebeb2da3d3e474c60f765020ede3cf23cfb03be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 4 Jul 2018 13:36:16 +0200 Subject: [PATCH] Fix displaying errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- settings/src/components/appList/appItem.vue | 8 ++++---- settings/src/store/apps.js | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/settings/src/components/appList/appItem.vue b/settings/src/components/appList/appItem.vue index 5a4a503f3c..f9d5754b50 100644 --- a/settings/src/components/appList/appItem.vue +++ b/settings/src/components/appList/appItem.vue @@ -51,10 +51,10 @@
{{ app.error }}
- - - - + + + +
diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js index c4539b14d9..99bd4af459 100644 --- a/settings/src/store/apps.js +++ b/settings/src/store/apps.js @@ -62,8 +62,13 @@ const mutations = { }, setError(state, {appId, error}) { - let app = state.apps.find(app => app.id === appId); - app.error = error; + if (!Array.isArray(appId)) { + appId = [appId]; + } + appId.forEach((_id) => { + let app = state.apps.find(app => app.id === _id); + app.error = error; + }); }, clearError(state, {appId, error}) { @@ -199,10 +204,13 @@ const actions = { }); }) .catch((error) => { - context.commit('setError', {appId: apps, error: t('settings', 'Error while enabling app')}); context.commit('stopLoading', apps); context.commit('stopLoading', 'install'); - context.commit('APPS_API_FAILURE', { appId, error }) + context.commit('setError', { + appId: apps, + error: error.response.data.data.message + }); + context.commit('APPS_API_FAILURE', { appId, error}); }) }).catch((error) => context.commit('API_FAILURE', { appId, error })); },