diff --git a/packages/graphql/api/customers.ts b/packages/graphql/api/customers.ts index 802c732..c5a3aed 100644 --- a/packages/graphql/api/customers.ts +++ b/packages/graphql/api/customers.ts @@ -47,21 +47,6 @@ export class CustomersService extends BaseService { return mutationResult.data; } - async getCustomer(variables: VariablesOf) { - const { query } = await getClientWithToken(); - - const result = await query({ - query: GQL.GetCustomerDocument, - variables, - }); - - if (result.error) throw new Error(result.error.message); - - const customer = result.data.customers.at(0); - - return { customer }; - } - async getClients(variables?: VariablesOf) { const { query } = await getClientWithToken(); @@ -72,11 +57,22 @@ export class CustomersService extends BaseService { }, }); - if (result.error) throw new Error(result.error.message); - return result.data; } + async getCustomer(variables: VariablesOf) { + const { query } = await getClientWithToken(); + + const result = await query({ + query: GQL.GetCustomerDocument, + variables, + }); + + const customer = result.data.customers.at(0); + + return { customer }; + } + async getMasters(variables?: VariablesOf) { const { query } = await getClientWithToken(); @@ -87,8 +83,6 @@ export class CustomersService extends BaseService { }, }); - if (result.error) throw new Error(result.error.message); - return result.data; } diff --git a/packages/graphql/api/orders.ts b/packages/graphql/api/orders.ts index 83036bb..a6a3a1e 100644 --- a/packages/graphql/api/orders.ts +++ b/packages/graphql/api/orders.ts @@ -97,8 +97,6 @@ export class OrdersService extends BaseService { variables, }); - if (result.error) throw new Error(result.error.message); - return result.data; } @@ -119,8 +117,6 @@ export class OrdersService extends BaseService { }, }); - if (result.error) throw new Error(result.error.message); - return result.data; } } diff --git a/packages/graphql/api/services.ts b/packages/graphql/api/services.ts index 202d514..7617da7 100644 --- a/packages/graphql/api/services.ts +++ b/packages/graphql/api/services.ts @@ -12,8 +12,6 @@ export class ServicesService extends BaseService { variables, }); - if (result.error) throw new Error(result.error.message); - return result.data; } @@ -25,8 +23,6 @@ export class ServicesService extends BaseService { variables, }); - if (result.error) throw new Error(result.error.message); - return result.data; } } diff --git a/packages/graphql/api/slots.ts b/packages/graphql/api/slots.ts index cec70d7..f6a33f4 100644 --- a/packages/graphql/api/slots.ts +++ b/packages/graphql/api/slots.ts @@ -119,8 +119,6 @@ export class SlotsService extends BaseService { variables, }); - if (result.error) throw new Error(result.error.message); - return result.data; } @@ -137,8 +135,6 @@ export class SlotsService extends BaseService { }, }); - if (result.error) throw new Error(result.error.message); - return result.data; }