Function
getAdEntity
({
postId,
squadId,
}: {
postId?: string;
squadId?: string;
})
Source from the content-addressed store, hash-verified
| 9 | import { useOptionalSquadPageContext } from '../squads/SquadPageContext'; |
| 10 | |
| 11 | const getAdEntity = ({ |
| 12 | postId, |
| 13 | squadId, |
| 14 | }: { |
| 15 | postId?: string; |
| 16 | squadId?: string; |
| 17 | }): AdEntityTarget | undefined => { |
| 18 | if (postId) { |
| 19 | return { entity: AdEntity.Post, id: postId }; |
| 20 | } |
| 21 | |
| 22 | if (squadId) { |
| 23 | return { entity: AdEntity.Source, id: squadId }; |
| 24 | } |
| 25 | |
| 26 | return undefined; |
| 27 | }; |
| 28 | |
| 29 | interface UseAdEntityRef { |
| 30 | entityRef: MutableRefObject<AdEntityTarget | undefined>; |
Tested by
no test coverage detected