UNPKG

@amityco/ts-sdk-react-native

Version:

Amity Social Cloud Typescript SDK

18 lines (15 loc) 434 B
import { pullFromCache } from '~/cache/api/pullFromCache'; export const userLinkedObject = (user: Amity.InternalUser): Amity.User => { return { ...user, get avatar(): Amity.File<'image'> | undefined { if (!user.avatarFileId) return undefined; const avatar = pullFromCache<Amity.File<'image'>>([ 'file', 'get', `${user.avatarFileId}`, ])?.data; return avatar; }, }; };