fix ordering of social actions

This commit is contained in:
Julien Fastré 2022-04-25 22:14:36 +02:00
parent e5209ca6d9
commit 75250402c8
2 changed files with 4 additions and 2 deletions

View File

@ -111,7 +111,7 @@ export default {
return this.$store.state.socialIssuesOther; return this.$store.state.socialIssuesOther;
}, },
socialActionsList() { socialActionsList() {
return this.$store.state.socialActionsList return this.$store.getters.socialActionsListSorted;
}, },
socialActionsSelected() { socialActionsSelected() {
return this.$store.state.activity.socialActions; return this.$store.state.activity.socialActions;

View File

@ -101,6 +101,9 @@ const store = createStore({
state.activity.activityType.thirdPartiesVisible !== 0) state.activity.activityType.thirdPartiesVisible !== 0)
); );
}, },
socialActionsListSorted(state) {
return [ ...state.socialActionsList].sort((a, b) => a.ordering - b.ordering);
},
}, },
mutations: { mutations: {
// SocialIssueAcc // SocialIssueAcc
@ -132,7 +135,6 @@ const store = createStore({
}, },
addActionInList(state, action) { addActionInList(state, action) {
state.socialActionsList.push(action); state.socialActionsList.push(action);
state.socialActionsList = state.socialActionsList.sort((a, b) => a.ordering-b.ordering);
}, },
updateActionsSelected(state, actions) { updateActionsSelected(state, actions) {
//console.log('update actions selected', actions); //console.log('update actions selected', actions);