38 lines
1.2 KiB
TypeScript
38 lines
1.2 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 addMasters(...variables: Parameters<CustomersService['addMasters']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.addMasters(...variables));
|
|
}
|
|
|
|
export async function getClients(...variables: Parameters<CustomersService['getClients']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getClients(...variables));
|
|
}
|
|
|
|
export async function getCustomer(...variables: Parameters<CustomersService['getCustomer']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getCustomer(...variables));
|
|
}
|
|
|
|
export async function getMasters(...variables: Parameters<CustomersService['getMasters']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getMasters(...variables));
|
|
}
|
|
|
|
export async function updateCustomer(...variables: Parameters<CustomersService['updateCustomer']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.updateCustomer(...variables));
|
|
}
|