some setup in frontend

This commit is contained in:
Julie Lenaerts 2023-11-08 12:23:10 +01:00
parent b172ebdf76
commit b5f7f578da
3 changed files with 21 additions and 25 deletions

View File

@ -131,6 +131,7 @@ export default {
}
},
mounted() {
this.$store.dispatch('getDashboardItems', {userId: 1})
for (const m of [
'MyNotifications',
'MyAccompanyingCourses',

View File

@ -39,10 +39,11 @@
</div>
</div>
<!--
<div class="mbloc col col-sm-6 col-lg-4">
<div class="custom2">
Mon dashboard personnalisé
News
<MyWidget :chart-data="chartData" />
</div>
</div>
<div class="mbloc col col-sm-6 col-lg-4">
@ -50,12 +51,6 @@
Mon dashboard personnalisé
</div>
</div>
<div class="mbloc col col-sm-6 col-lg-4">
<div class="custom4">
Mon dashboard personnalisé
</div>
</div>
-->
</div>
</template>
@ -70,7 +65,7 @@ export default {
return {
counterClass: {
counter: true //hack to pass class 'counter' in i18n-t
}
},
}
},
computed: {

View File

@ -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: {
getByTab({ commit, getters }, { tab, param }) {
switch (tab) {
case 'MyCustoms':
const url = `/api/1.0/main/news.json`;
getDashboardItems({commit, getters}, { userId }) {
const url = `/api/1.0/main/dashboard-item/${userId}.json`;
makeFetch('GET', url)
.then((response) => {
console.log('news', response.results)
commit('addNewsItems', response);
console.log('dashboardItems', response.results)
commit('addDashboardItems', response);
})
.catch((error) => {
commit('catchError', error);
throw error;
})
;
break;
},
getByTab({ commit, getters }, { tab, param }) {
switch (tab) {
// case 'MyWorks':
// if (!getters.isWorksLoaded) {
// commit('setLoading', true);