- Introduced getCustomers action and corresponding server method to fetch customer data with pagination and sorting. - Updated hooks to support infinite querying of customers, improving data handling in components. - Refactored ContactsList and related components to utilize the new customer fetching logic, enhancing user experience. - Adjusted filter labels in dropdowns for better clarity and user understanding.
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
'use server';
|
|
|
|
import { useService } from '../lib/service';
|
|
import { wrapServerAction } from '@/utils/actions';
|
|
import { CustomersService } from '@repo/graphql/api/customers';
|
|
|
|
const getService = useService(CustomersService);
|
|
|
|
export async function addInvitedBy(...variables: Parameters<CustomersService['addInvitedBy']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.addInvitedBy(...variables));
|
|
}
|
|
|
|
export async function getCustomer(...variables: Parameters<CustomersService['getCustomer']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getCustomer(...variables));
|
|
}
|
|
|
|
export async function getCustomers(...variables: Parameters<CustomersService['getCustomers']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getCustomers(...variables));
|
|
}
|
|
|
|
export async function getInvited(...variables: Parameters<CustomersService['getInvited']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getInvited(...variables));
|
|
}
|
|
|
|
export async function getInvitedBy(...variables: Parameters<CustomersService['getInvitedBy']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getInvitedBy(...variables));
|
|
}
|
|
|
|
export async function updateCustomer(...variables: Parameters<CustomersService['updateCustomer']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.updateCustomer(...variables));
|
|
}
|