Vlad Chikalkin 9314cdd1cb
merge branch 'refactor-api' (#23)
* refactor customer api

* refactor slots api

* hooks/customers: use invalidateQueries

* refactor services api

* optimize hooks queryKey

* refactor orders api

* typo refactor hooks

* fix telegramId type (number)

* fix bot with new api

* rename customers masters & clients query

* fix useClientsQuery & useMastersQuery query

* new line after 'use client' & 'use server' directives
2025-05-20 14:27:51 +03:00

33 lines
880 B
TypeScript

import { getClientWithToken } from '../apollo/client';
import * as GQL from '../types';
import { BaseService } from './base';
import { type VariablesOf } from '@graphql-typed-document-node/core';
export class ServicesService extends BaseService {
async getService(variables: VariablesOf<typeof GQL.GetServiceDocument>) {
const { query } = await getClientWithToken();
const result = await query({
query: GQL.GetServiceDocument,
variables,
});
if (result.error) throw new Error(result.error.message);
return result.data;
}
async getServices(variables: VariablesOf<typeof GQL.GetServicesDocument>) {
const { query } = await getClientWithToken();
const result = await query({
query: GQL.GetServicesDocument,
variables,
});
if (result.error) throw new Error(result.error.message);
return result.data;
}
}