MCPcopy Create free account
hub / github.com/dailydotdev/apps / getCompanySupportChats

Function getCompanySupportChats

packages/shared/src/features/messages/graphql.ts:415–436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

413const maxSupportChatPages = 10;
414
415export const getCompanySupportChats = async (): Promise<
416 CompanySupportChat[]
417> => {
418 const chats: CompanySupportChat[] = [];
419 let after: string | undefined;
420
421 for (let page = 0; page < maxSupportChatPages; page += 1) {
422 // eslint-disable-next-line no-await-in-loop
423 const res = await gqlClient.request<{
424 companySupportChats: Connection<CompanySupportChat>;
425 }>(COMPANY_SUPPORT_CHATS_QUERY, { first: supportChatsPageSize, after });
426 const { edges, pageInfo } = res.companySupportChats;
427 chats.push(...edges.map(({ node }) => node));
428
429 if (!pageInfo?.hasNextPage || !pageInfo.endCursor) {
430 break;
431 }
432 after = pageInfo.endCursor;
433 }
434
435 return chats;
436};
437
438export const getCompanySupportChat = async (
439 id: string,

Callers 1

loadSupportConversationsFunction · 0.90

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected