Systems sorted by State!

This commit is contained in:
Luke Berndt
2023-01-28 10:19:35 -05:00
parent b7e2419109
commit fe91b93a84
5 changed files with 109 additions and 69 deletions

View File

@@ -44,20 +44,5 @@ export const apiSlice = createApi({
})
})
export const selectSystemsResult = apiSlice.endpoints.getSystems.select();
const emptySystems = []
export const selectAllSystems = createSelector(
selectSystemsResult,
systemsResult => systemsResult?.data ?? emptySystems
)
export const selectActiveSystems = createSelector(
selectAllSystems,
(state, userId) => userId,
(systems, userId) => systems.find(system => system.active === true)
)
// Export the auto-generated hook for the `getPosts` query endpoint
export const { useGetGroupsQuery, useGetSystemsQuery, useGetTalkgroupsQuery, useGetEventsQuery, useGetEventQuery, useAddNewEventMutation } = apiSlice