2022-07-27 06:54:43 +00:00
|
|
|
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,
|
2022-08-08 10:17:32 +00:00
|
|
|
getMeta: state => {
|
|
|
|
return state.meta;
|
|
|
|
},
|
|
|
|
getSelectedPortal: (...getterArguments) => {
|
|
|
|
const [state, _getters] = getterArguments;
|
|
|
|
const { selectedPortalId } = state.portals;
|
|
|
|
return _getters.portalById(selectedPortalId);
|
|
|
|
},
|
2022-07-27 06:54:43 +00:00
|
|
|
};
|