22 lines
851 B
TypeScript
22 lines
851 B
TypeScript
'use server';
|
|
import { getCustomer } from './api/customers';
|
|
import { _temporaryGetCustomer } from './api/lib/service';
|
|
import * as api from '@repo/graphql/api/service';
|
|
// eslint-disable-next-line sonarjs/no-internal-api-use
|
|
import type * as ApolloTypes from '@repo/graphql/node_modules/@apollo/client/core';
|
|
import { type GetServicesQueryVariables } from '@repo/graphql/types';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
type FixTypescriptCringe = ApolloTypes.FetchResult;
|
|
|
|
export async function getServices(input?: GetServicesQueryVariables) {
|
|
const variables = await _temporaryGetCustomer();
|
|
const { customer } = await getCustomer(variables);
|
|
|
|
const filters = input || { filters: { master: { documentId: { eq: customer?.documentId } } } };
|
|
|
|
return api.getServices(filters);
|
|
}
|
|
|
|
export const getService = api.getService;
|