2025-05-16 16:47:12 +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;
}
}