UNPKG

@amityco/ts-sdk-react-native

Version:

Amity Social Cloud Typescript SDK

20 lines (16 loc) 599 B
import { dropFromCache, pushToCache, queryCache } from '~/cache/api'; export const addFlagSubChannelUnreadByChannelId = (channelId: string) => { const cacheKey = ['subChannelUnreadInfo', 'get']; const cachedSubChannelUnread = queryCache<Amity.SubChannelUnreadInfo>(cacheKey); if (cachedSubChannelUnread) { const cachedTargetSubChannelUnread = cachedSubChannelUnread?.filter( ({ data }) => data.channelId === channelId, ); cachedTargetSubChannelUnread.forEach(({ key, data }) => { pushToCache(key, { ...data, isDeleted: true, }); }); } };