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() { mounted() {
this.$store.dispatch('getDashboardItems', {userId: 1})
for (const m of [ for (const m of [
'MyNotifications', 'MyNotifications',
'MyAccompanyingCourses', 'MyAccompanyingCourses',

View File

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

View File

@ -24,7 +24,7 @@ const store = createStore({
workflows: {}, workflows: {},
workflowsCc: {}, workflowsCc: {},
errorMsg: [], errorMsg: [],
newsItems: {}, dashboardItems: {},
loading: false loading: false
}, },
getters: { getters: {
@ -98,26 +98,26 @@ const store = createStore({
catchError(state, error) { catchError(state, error) {
state.errorMsg.push(error); state.errorMsg.push(error);
}, },
addNewsItems(state, newsItems) { addDashboardItems(state, dashboardItems) {
state.newsItems = newsItems; state.dashboardItems = dashboardItems;
} }
}, },
actions: { 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 }) { getByTab({ commit, getters }, { tab, param }) {
switch (tab) { 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': // case 'MyWorks':
// if (!getters.isWorksLoaded) { // if (!getters.isWorksLoaded) {
// commit('setLoading', true); // commit('setLoading', true);