Chatwoot/app/javascript/dashboard/store/modules/teams/getters.js
Nithin David Thomas eaafc45f45
feat: Show teams on sidebar (#1754)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
Co-authored-by: Sojan <sojan@pepalo.com>
2021-02-13 14:58:05 +05:30

18 lines
432 B
JavaScript

export const getters = {
getTeams($state) {
return Object.values($state.records).sort((a, b) => a.id - b.id);
},
getMyTeams($state, $getters) {
return $getters.getTeams.filter(team => {
const { is_member: isMember } = team;
return isMember;
});
},
getUIFlags($state) {
return $state.uiFlags;
},
getTeam: $state => id => {
const team = $state.records[id];
return team || {};
},
};