UNPKG

fastcomments-react-native-sdk

Version:

React Native FastComments Components. Add live commenting to any React Native application.

34 lines (33 loc) 1.2 kB
import { createURLQueryString, makeRequest } from "./http"; // this is used for handling live events since the pub-sub server is stateless. export async function checkBlockedComments(state, commentIds) { if (state.currentUser && 'hasBlockedUsers' in state.currentUser && state.currentUser.hasBlockedUsers) { try { const response = await makeRequest({ apiHost: state.apiHost, method: 'GET', url: '/check-blocked-comments' + createURLQueryString({ commentIds: commentIds.join(','), tenantId: state.config.tenantId, sso: state.ssoConfigString }), }); return response.commentStatuses; } catch (e) { console.error(e); const result = {}; // on failure just assume all visible for (const id of commentIds) { result[id] = false; } return result; } } else { const result = {}; // just assume all visible for (const id of commentIds) { result[id] = false; } return result; } }