feat: Create store to manage Portals (#5020)
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
committed by
GitHub
parent
1594d49a70
commit
bfca4852c8
@@ -0,0 +1,26 @@
|
||||
export const getters = {
|
||||
uiFlagsIn: state => portalId => {
|
||||
const uiFlags = state.portals.uiFlags.byId[portalId];
|
||||
if (uiFlags) return uiFlags;
|
||||
return { isFetching: false, isUpdating: false, isDeleting: false };
|
||||
},
|
||||
|
||||
isFetchingPortals: state => state.uiFlags.isFetching,
|
||||
portalById: (...getterArguments) => portalId => {
|
||||
const [state] = getterArguments;
|
||||
const portal = state.portals.byId[portalId];
|
||||
|
||||
return {
|
||||
...portal,
|
||||
};
|
||||
},
|
||||
allPortals: (...getterArguments) => {
|
||||
const [state, _getters] = getterArguments;
|
||||
|
||||
const portals = state.portals.allIds.map(id => {
|
||||
return _getters.portalById(id);
|
||||
});
|
||||
return portals;
|
||||
},
|
||||
count: state => state.portals.allIds.length || 0,
|
||||
};
|
||||
Reference in New Issue
Block a user