UNPKG

@amityco/ts-sdk-react-native

Version:

Amity Social Cloud Typescript SDK

13 lines (9 loc) 316 B
import { pullFromCache } from '~/cache/api'; export const checkUserPermission = ( userId: Amity.User['userId'] | undefined, permission: string, ) => { const user = pullFromCache<Amity.User>(['user', 'get', userId])?.data; if (!user) return false; return user.permissions.some(x => x === permission); };