2025-01-14 15:40:31 +03:00

22 lines
673 B
TypeScript

'use server';
import { authOptions } from '@/config/auth';
import { getCustomerClients, getCustomerMasters } from '@repo/graphql/api';
import { getServerSession } from 'next-auth/next';
export async function getContacts() {
const session = await getServerSession(authOptions);
if (session) {
const { user } = session;
const getCustomerMastersResponse = await getCustomerMasters({ telegramId: user?.telegramId });
const getCustomerClientsResponse = await getCustomerClients({ telegramId: user?.telegramId });
return {
clients: getCustomerClientsResponse?.clients,
masters: getCustomerMastersResponse?.masters,
};
}
return null;
}