chore: Sets up store for teams settings page (#1727)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
committed by
GitHub
parent
c61edff189
commit
6a614a520b
47
app/javascript/dashboard/store/modules/teams/mutations.js
Normal file
47
app/javascript/dashboard/store/modules/teams/mutations.js
Normal 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);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user