chore: Sets up store for teams settings page (#1727)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2021-02-04 13:19:59 +05:30
committed by GitHub
parent c61edff189
commit 6a614a520b
17 changed files with 608 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import Vue from 'vue';
import {
SET_TEAM_UI_FLAG,
CLEAR_TEAMS,
SET_TEAMS,
SET_TEAM_ITEM,
EDIT_TEAM,
DELETE_TEAM,
} from './types';
export const mutations = {
[SET_TEAM_UI_FLAG]($state, data) {
$state.uiFlags = {
...$state.uiFlags,
...data,
};
},
[CLEAR_TEAMS]: $state => {
Vue.set($state, 'records', {});
},
[SET_TEAMS]: ($state, data) => {
data.forEach(team => {
Vue.set($state.records, team.id, {
...($state.records[team.id] || {}),
...team,
});
});
},
[SET_TEAM_ITEM]: ($state, data) => {
Vue.set($state.records, data.id, {
...($state.records[data.id] || {}),
...data,
});
},
[EDIT_TEAM]: ($state, data) => {
Vue.set($state.records, data.id, data);
},
[DELETE_TEAM]: ($state, teamId) => {
const { [teamId]: toDelete, ...records } = $state.records;
Vue.set($state, 'records', records);
},
};