activity/location: refactor

Refactor the way for loading locations:

* fix showing the default location
* fix when there is not thirdparty default location
* separate api queries instead of inlines;
* use the store instead of the mounted
* refactored for a possible re-use in calendar
This commit is contained in:
2021-12-14 23:20:47 +01:00
parent 3a9fac08c3
commit de790d11a8
4 changed files with 139 additions and 119 deletions

View File

@@ -1,6 +1,7 @@
import 'es6-promise/auto';
import { createStore } from 'vuex';
import { postLocation } from './api';
import prepareLocations from './store.locations.js';
const debug = process.env.NODE_ENV !== 'production';
//console.log('window.activity', window.activity);
@@ -25,6 +26,7 @@ const store = createStore({
activity: window.activity,
socialIssuesOther: [],
socialActionsList: [],
availableLocations: [],
},
getters: {
suggestedEntities(state) {
@@ -200,6 +202,9 @@ const store = createStore({
console.log("### mutation: updateLocation", value);
state.activity.location = value;
},
addAvailableLocationGroup(state, group) {
state.availableLocations.push(group);
}
},
actions: {
addIssueSelected({ commit }, issue) {
@@ -335,4 +340,6 @@ const store = createStore({
},
});
prepareLocations(store);
export default store;