diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue index 315fd863f..908b9eb1c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue @@ -131,6 +131,7 @@ export default { } }, mounted() { + this.$store.dispatch('getDashboardItems', {userId: 1}) for (const m of [ 'MyNotifications', 'MyAccompanyingCourses', diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue index 1fe4dfd7c..4a79ddd49 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue @@ -39,10 +39,11 @@ - @@ -70,7 +65,7 @@ export default { return { counterClass: { counter: true //hack to pass class 'counter' in i18n-t - } + }, } }, computed: { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js index ab2e44b1d..1f9527b4f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js @@ -24,7 +24,7 @@ const store = createStore({ workflows: {}, workflowsCc: {}, errorMsg: [], - newsItems: {}, + dashboardItems: {}, loading: false }, getters: { @@ -98,26 +98,26 @@ const store = createStore({ catchError(state, error) { state.errorMsg.push(error); }, - addNewsItems(state, newsItems) { - state.newsItems = newsItems; + addDashboardItems(state, dashboardItems) { + state.dashboardItems = dashboardItems; } }, actions: { + getDashboardItems({commit, getters}, { userId }) { + const url = `/api/1.0/main/dashboard-item/${userId}.json`; + makeFetch('GET', url) + .then((response) => { + console.log('dashboardItems', response.results) + commit('addDashboardItems', response); + }) + .catch((error) => { + commit('catchError', error); + throw error; + }) + ; + }, getByTab({ commit, getters }, { tab, param }) { switch (tab) { - case 'MyCustoms': - const url = `/api/1.0/main/news.json`; - makeFetch('GET', url) - .then((response) => { - console.log('news', response.results) - commit('addNewsItems', response); - }) - .catch((error) => { - commit('catchError', error); - throw error; - }) - ; - break; // case 'MyWorks': // if (!getters.isWorksLoaded) { // commit('setLoading', true);