[ABANDONED] React/Redux front end for the Flexor social network.
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.
 
 

16 lines
590 B

import { denormalize } from 'src/utils/normalization'
import { AppState, Post, EntityType, EntityListKey } from 'src/types'
export const getTimeline = (state: AppState) => {
const entityList = state.lists[EntityListKey.Timeline]
if (!entityList) return []
return denormalize(entityList.entities, EntityType.Post, state.entities) as Post[]
}
export const getUserPosts = (state: AppState, id: string) => {
const entityList = state.lists[`posts:${id}`]
if (!entityList) return []
return denormalize(entityList.entities, EntityType.Post, state.entities) as Post[]
}