You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
589 B
18 lines
589 B
|
|
import { createSelector } from 'reselect'
|
|
|
|
import { denormalize } from 'src/utils/normalization'
|
|
import { getEntityStore } from './entities'
|
|
import { getAuthenticatedUserId } from './authentication'
|
|
|
|
import { EntityType, App } from 'src/types'
|
|
|
|
export const getSelfApps = createSelector(
|
|
[getEntityStore, getAuthenticatedUserId],
|
|
(entities, userId) => {
|
|
const apps = entities[EntityType.App]
|
|
if (!apps) return []
|
|
|
|
return denormalize(Object.values(apps).filter(app => app.userId === userId).map(user => user.id), EntityType.User, entities) as App[]
|
|
}
|
|
)
|