From 93ba9378ef9a74e25a3fc8a725d0b9105b2caeef Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 10 Mar 2020 14:33:43 +0100 Subject: [PATCH] Update types --- src/auth/mutations.ts | 15 ++--- src/auth/types/RequestPasswordReset.ts | 6 +- src/auth/types/SetPassword.ts | 8 +-- src/customers/mutations.ts | 55 +++++++++++-------- src/customers/types/AccountErrorFragment.ts | 15 +++++ src/customers/types/BulkRemoveCustomers.ts | 6 +- src/customers/types/CreateCustomer.ts | 6 +- src/customers/types/CreateCustomerAddress.ts | 6 +- src/customers/types/RemoveCustomer.ts | 6 +- src/customers/types/RemoveCustomerAddress.ts | 6 +- .../types/SetCustomerDefaultAddress.ts | 6 +- src/customers/types/UpdateCustomer.ts | 6 +- src/customers/types/UpdateCustomerAddress.ts | 6 +- src/services/mutations.ts | 35 ++++++------ src/services/types/ServiceCreate.ts | 8 +-- src/services/types/ServiceDelete.ts | 6 +- src/services/types/ServiceTokenCreate.ts | 8 +-- src/services/types/ServiceTokenDelete.ts | 6 +- src/services/types/ServiceUpdate.ts | 6 +- src/staff/mutations.ts | 37 +++++++------ src/staff/types/ChangeStaffPassword.ts | 6 +- src/staff/types/StaffAvatarDelete.ts | 6 +- src/staff/types/StaffAvatarUpdate.ts | 6 +- src/staff/types/StaffMemberAdd.ts | 6 +- src/staff/types/StaffMemberDelete.ts | 6 +- src/staff/types/StaffMemberUpdate.ts | 6 +- src/types/globalTypes.ts | 22 ++++++++ 27 files changed, 189 insertions(+), 122 deletions(-) create mode 100644 src/customers/types/AccountErrorFragment.ts diff --git a/src/auth/mutations.ts b/src/auth/mutations.ts index 5138d6c2f..60ca7b91b 100644 --- a/src/auth/mutations.ts +++ b/src/auth/mutations.ts @@ -1,5 +1,6 @@ import gql from "graphql-tag"; +import { accountFragmentError } from "@saleor/customers/mutations"; import { TypedMutation } from "../mutations"; import { RequestPasswordReset, @@ -64,11 +65,11 @@ export const TypedVerifyTokenMutation = TypedMutation< >(tokenVerifyMutation); export const requestPasswordReset = gql` + ${accountFragmentError} mutation RequestPasswordReset($email: String!, $redirectUrl: String!) { requestPasswordReset(email: $email, redirectUrl: $redirectUrl) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } @@ -79,14 +80,14 @@ export const RequestPasswordResetMutation = TypedMutation< >(requestPasswordReset); export const setPassword = gql` + ${accountFragmentError} ${fragmentUser} mutation SetPassword($email: String!, $password: String!, $token: String!) { setPassword(email: $email, password: $password, token: $token) { - token - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } + token user { ...User } diff --git a/src/auth/types/RequestPasswordReset.ts b/src/auth/types/RequestPasswordReset.ts index c011b0794..87ba8684a 100644 --- a/src/auth/types/RequestPasswordReset.ts +++ b/src/auth/types/RequestPasswordReset.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: RequestPasswordReset // ==================================================== export interface RequestPasswordReset_requestPasswordReset_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface RequestPasswordReset_requestPasswordReset { diff --git a/src/auth/types/SetPassword.ts b/src/auth/types/SetPassword.ts index 9a4c04509..805728d35 100644 --- a/src/auth/types/SetPassword.ts +++ b/src/auth/types/SetPassword.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { PermissionEnum } from "./../../types/globalTypes"; +import { AccountErrorCode, PermissionEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: SetPassword // ==================================================== export interface SetPassword_setPassword_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface SetPassword_setPassword_user_permissions { @@ -37,8 +37,8 @@ export interface SetPassword_setPassword_user { export interface SetPassword_setPassword { __typename: "SetPassword"; + errors: SetPassword_setPassword_errors[] | null; token: string | null; - errors: (SetPassword_setPassword_errors | null)[]; user: SetPassword_setPassword_user | null; } diff --git a/src/customers/mutations.ts b/src/customers/mutations.ts index 1c80da368..c07d36e89 100644 --- a/src/customers/mutations.ts +++ b/src/customers/mutations.ts @@ -36,13 +36,20 @@ import { UpdateCustomerAddressVariables } from "./types/UpdateCustomerAddress"; +export const accountFragmentError = gql` + fragment AccountErrorFragment on AccountError { + code + field + } +`; + const updateCustomer = gql` + ${accountFragmentError} ${customerDetailsFragment} mutation UpdateCustomer($id: ID!, $input: CustomerInput!) { customerUpdate(id: $id, input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { ...CustomerDetailsFragment @@ -56,11 +63,11 @@ export const TypedUpdateCustomerMutation = TypedMutation< >(updateCustomer); const createCustomer = gql` + ${accountFragmentError} mutation CreateCustomer($input: UserCreateInput!) { customerCreate(input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { id @@ -74,11 +81,11 @@ export const TypedCreateCustomerMutation = TypedMutation< >(createCustomer); const removeCustomer = gql` + ${accountFragmentError} mutation RemoveCustomer($id: ID!) { customerDelete(id: $id) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } @@ -89,6 +96,7 @@ export const TypedRemoveCustomerMutation = TypedMutation< >(removeCustomer); const setCustomerDefaultAddress = gql` + ${accountFragmentError} ${customerAddressesFragment} mutation SetCustomerDefaultAddress( $addressId: ID! @@ -96,9 +104,8 @@ const setCustomerDefaultAddress = gql` $type: AddressTypeEnum! ) { addressSetDefault(addressId: $addressId, userId: $userId, type: $type) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { ...CustomerAddressesFragment @@ -112,13 +119,13 @@ export const TypedSetCustomerDefaultAddressMutation = TypedMutation< >(setCustomerDefaultAddress); const createCustomerAddress = gql` + ${accountFragmentError} ${customerAddressesFragment} ${fragmentAddress} mutation CreateCustomerAddress($id: ID!, $input: AddressInput!) { addressCreate(userId: $id, input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } address { ...AddressFragment @@ -135,12 +142,12 @@ export const TypedCreateCustomerAddressMutation = TypedMutation< >(createCustomerAddress); const updateCustomerAddress = gql` + ${accountFragmentError} ${fragmentAddress} mutation UpdateCustomerAddress($id: ID!, $input: AddressInput!) { addressUpdate(id: $id, input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } address { ...AddressFragment @@ -154,12 +161,12 @@ export const TypedUpdateCustomerAddressMutation = TypedMutation< >(updateCustomerAddress); const removeCustomerAddress = gql` + ${accountFragmentError} ${customerAddressesFragment} mutation RemoveCustomerAddress($id: ID!) { addressDelete(id: $id) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { ...CustomerAddressesFragment @@ -173,11 +180,11 @@ export const TypedRemoveCustomerAddressMutation = TypedMutation< >(removeCustomerAddress); export const bulkRemoveCustomers = gql` + ${accountFragmentError} mutation BulkRemoveCustomers($ids: [ID]!) { customerBulkDelete(ids: $ids) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } diff --git a/src/customers/types/AccountErrorFragment.ts b/src/customers/types/AccountErrorFragment.ts new file mode 100644 index 000000000..3b96c2f5c --- /dev/null +++ b/src/customers/types/AccountErrorFragment.ts @@ -0,0 +1,15 @@ +/* tslint:disable */ +/* eslint-disable */ +// This file was automatically generated and should not be edited. + +import { AccountErrorCode } from "./../../types/globalTypes"; + +// ==================================================== +// GraphQL fragment: AccountErrorFragment +// ==================================================== + +export interface AccountErrorFragment { + __typename: "AccountError"; + code: AccountErrorCode; + field: string | null; +} diff --git a/src/customers/types/BulkRemoveCustomers.ts b/src/customers/types/BulkRemoveCustomers.ts index 5af102d77..206900f35 100644 --- a/src/customers/types/BulkRemoveCustomers.ts +++ b/src/customers/types/BulkRemoveCustomers.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: BulkRemoveCustomers // ==================================================== export interface BulkRemoveCustomers_customerBulkDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface BulkRemoveCustomers_customerBulkDelete { diff --git a/src/customers/types/CreateCustomer.ts b/src/customers/types/CreateCustomer.ts index 6f9a4ec3e..6b75e5d8d 100644 --- a/src/customers/types/CreateCustomer.ts +++ b/src/customers/types/CreateCustomer.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { UserCreateInput } from "./../../types/globalTypes"; +import { UserCreateInput, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: CreateCustomer // ==================================================== export interface CreateCustomer_customerCreate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface CreateCustomer_customerCreate_user { diff --git a/src/customers/types/CreateCustomerAddress.ts b/src/customers/types/CreateCustomerAddress.ts index 2dfd3f2d9..5ffafaee9 100644 --- a/src/customers/types/CreateCustomerAddress.ts +++ b/src/customers/types/CreateCustomerAddress.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { AddressInput } from "./../../types/globalTypes"; +import { AddressInput, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: CreateCustomerAddress // ==================================================== export interface CreateCustomerAddress_addressCreate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface CreateCustomerAddress_addressCreate_address_country { diff --git a/src/customers/types/RemoveCustomer.ts b/src/customers/types/RemoveCustomer.ts index ddc504728..ceaddf38a 100644 --- a/src/customers/types/RemoveCustomer.ts +++ b/src/customers/types/RemoveCustomer.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: RemoveCustomer // ==================================================== export interface RemoveCustomer_customerDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface RemoveCustomer_customerDelete { diff --git a/src/customers/types/RemoveCustomerAddress.ts b/src/customers/types/RemoveCustomerAddress.ts index 69de7eafa..4d1769f49 100644 --- a/src/customers/types/RemoveCustomerAddress.ts +++ b/src/customers/types/RemoveCustomerAddress.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: RemoveCustomerAddress // ==================================================== export interface RemoveCustomerAddress_addressDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface RemoveCustomerAddress_addressDelete_user_addresses_country { diff --git a/src/customers/types/SetCustomerDefaultAddress.ts b/src/customers/types/SetCustomerDefaultAddress.ts index eefe47419..af2058f60 100644 --- a/src/customers/types/SetCustomerDefaultAddress.ts +++ b/src/customers/types/SetCustomerDefaultAddress.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { AddressTypeEnum } from "./../../types/globalTypes"; +import { AddressTypeEnum, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: SetCustomerDefaultAddress // ==================================================== export interface SetCustomerDefaultAddress_addressSetDefault_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface SetCustomerDefaultAddress_addressSetDefault_user_addresses_country { diff --git a/src/customers/types/UpdateCustomer.ts b/src/customers/types/UpdateCustomer.ts index f67fe8d00..61f7051c2 100644 --- a/src/customers/types/UpdateCustomer.ts +++ b/src/customers/types/UpdateCustomer.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { CustomerInput } from "./../../types/globalTypes"; +import { CustomerInput, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: UpdateCustomer // ==================================================== export interface UpdateCustomer_customerUpdate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface UpdateCustomer_customerUpdate_user_defaultShippingAddress_country { diff --git a/src/customers/types/UpdateCustomerAddress.ts b/src/customers/types/UpdateCustomerAddress.ts index 73fb000dc..e62b464a1 100644 --- a/src/customers/types/UpdateCustomerAddress.ts +++ b/src/customers/types/UpdateCustomerAddress.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { AddressInput } from "./../../types/globalTypes"; +import { AddressInput, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: UpdateCustomerAddress // ==================================================== export interface UpdateCustomerAddress_addressUpdate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface UpdateCustomerAddress_addressUpdate_address_country { diff --git a/src/services/mutations.ts b/src/services/mutations.ts index 92096ddad..090d6c1ad 100644 --- a/src/services/mutations.ts +++ b/src/services/mutations.ts @@ -1,5 +1,6 @@ import gql from "graphql-tag"; +import { accountFragmentError } from "@saleor/customers/mutations"; import { TypedMutation } from "../mutations"; import { serviceDetailsFragment, serviceFragment } from "./queries"; import { ServiceCreate, ServiceCreateVariables } from "./types/ServiceCreate"; @@ -15,14 +16,14 @@ import { import { ServiceUpdate, ServiceUpdateVariables } from "./types/ServiceUpdate"; const serviceCreateMutation = gql` + ${accountFragmentError} ${serviceFragment} mutation ServiceCreate($input: ServiceAccountInput!) { serviceAccountCreate(input: $input) { - errors { - field - message - } authToken + errors: accountErrors { + ...AccountErrorFragment + } serviceAccount { ...ServiceFragment } @@ -36,11 +37,11 @@ export const ServiceCreateMutation = TypedMutation< >(serviceCreateMutation); const serviceDeleteMutation = gql` + ${accountFragmentError} mutation ServiceDelete($id: ID!) { serviceAccountDelete(id: $id) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } @@ -51,12 +52,12 @@ export const ServiceDeleteMutation = TypedMutation< >(serviceDeleteMutation); const serviceUpdateMutation = gql` + ${accountFragmentError} ${serviceDetailsFragment} mutation ServiceUpdate($id: ID!, $input: ServiceAccountInput!) { serviceAccountUpdate(id: $id, input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } serviceAccount { ...ServiceDetailsFragment @@ -71,13 +72,13 @@ export const ServiceUpdateMutation = TypedMutation< >(serviceUpdateMutation); const serviceTokenCreate = gql` + ${accountFragmentError} mutation ServiceTokenCreate($input: ServiceAccountTokenInput!) { serviceAccountTokenCreate(input: $input) { - errors { - field - message - } authToken + errors: accountErrors { + ...AccountErrorFragment + } } } `; @@ -87,11 +88,11 @@ export const ServiceTokenCreateMutation = TypedMutation< >(serviceTokenCreate); const serviceTokenDelete = gql` + ${accountFragmentError} mutation ServiceTokenDelete($id: ID!) { serviceAccountTokenDelete(id: $id) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } diff --git a/src/services/types/ServiceCreate.ts b/src/services/types/ServiceCreate.ts index f9efe54e1..74b3a0aea 100644 --- a/src/services/types/ServiceCreate.ts +++ b/src/services/types/ServiceCreate.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { ServiceAccountInput } from "./../../types/globalTypes"; +import { ServiceAccountInput, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ServiceCreate // ==================================================== export interface ServiceCreate_serviceAccountCreate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface ServiceCreate_serviceAccountCreate_serviceAccount { @@ -23,8 +23,8 @@ export interface ServiceCreate_serviceAccountCreate_serviceAccount { export interface ServiceCreate_serviceAccountCreate { __typename: "ServiceAccountCreate"; - errors: ServiceCreate_serviceAccountCreate_errors[]; authToken: string | null; + errors: ServiceCreate_serviceAccountCreate_errors[]; serviceAccount: ServiceCreate_serviceAccountCreate_serviceAccount | null; } diff --git a/src/services/types/ServiceDelete.ts b/src/services/types/ServiceDelete.ts index 71e4c2064..a23793c72 100644 --- a/src/services/types/ServiceDelete.ts +++ b/src/services/types/ServiceDelete.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: ServiceDelete // ==================================================== export interface ServiceDelete_serviceAccountDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface ServiceDelete_serviceAccountDelete { diff --git a/src/services/types/ServiceTokenCreate.ts b/src/services/types/ServiceTokenCreate.ts index 3698104a2..7529a10c4 100644 --- a/src/services/types/ServiceTokenCreate.ts +++ b/src/services/types/ServiceTokenCreate.ts @@ -2,22 +2,22 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { ServiceAccountTokenInput } from "./../../types/globalTypes"; +import { ServiceAccountTokenInput, AccountErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ServiceTokenCreate // ==================================================== export interface ServiceTokenCreate_serviceAccountTokenCreate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface ServiceTokenCreate_serviceAccountTokenCreate { __typename: "ServiceAccountTokenCreate"; - errors: ServiceTokenCreate_serviceAccountTokenCreate_errors[]; authToken: string | null; + errors: ServiceTokenCreate_serviceAccountTokenCreate_errors[]; } export interface ServiceTokenCreate { diff --git a/src/services/types/ServiceTokenDelete.ts b/src/services/types/ServiceTokenDelete.ts index c0883203a..9cfad5249 100644 --- a/src/services/types/ServiceTokenDelete.ts +++ b/src/services/types/ServiceTokenDelete.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: ServiceTokenDelete // ==================================================== export interface ServiceTokenDelete_serviceAccountTokenDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface ServiceTokenDelete_serviceAccountTokenDelete { diff --git a/src/services/types/ServiceUpdate.ts b/src/services/types/ServiceUpdate.ts index eed851a78..d7f3ac964 100644 --- a/src/services/types/ServiceUpdate.ts +++ b/src/services/types/ServiceUpdate.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { ServiceAccountInput, PermissionEnum } from "./../../types/globalTypes"; +import { ServiceAccountInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ServiceUpdate // ==================================================== export interface ServiceUpdate_serviceAccountUpdate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface ServiceUpdate_serviceAccountUpdate_serviceAccount_permissions { diff --git a/src/staff/mutations.ts b/src/staff/mutations.ts index ee1dde297..60ada4cd9 100644 --- a/src/staff/mutations.ts +++ b/src/staff/mutations.ts @@ -1,6 +1,7 @@ import gql from "graphql-tag"; import makeMutation from "@saleor/hooks/makeMutation"; +import { accountFragmentError } from "@saleor/customers/mutations"; import { TypedMutation } from "../mutations"; import { staffMemberDetailsFragment } from "./queries"; import { StaffAvatarDelete } from "./types/StaffAvatarDelete"; @@ -26,12 +27,12 @@ import { } from "./types/ChangeStaffPassword"; const staffMemberAddMutation = gql` + ${accountFragmentError} ${staffMemberDetailsFragment} mutation StaffMemberAdd($input: StaffCreateInput!) { staffCreate(input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { ...StaffMemberDetailsFragment @@ -45,12 +46,12 @@ export const TypedStaffMemberAddMutation = TypedMutation< >(staffMemberAddMutation); const staffMemberUpdateMutation = gql` + ${accountFragmentError} ${staffMemberDetailsFragment} mutation StaffMemberUpdate($id: ID!, $input: StaffInput!) { staffUpdate(id: $id, input: $input) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { ...StaffMemberDetailsFragment @@ -64,11 +65,11 @@ export const TypedStaffMemberUpdateMutation = TypedMutation< >(staffMemberUpdateMutation); const staffMemberDeleteMutation = gql` + ${accountFragmentError} mutation StaffMemberDelete($id: ID!) { staffDelete(id: $id) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } @@ -79,11 +80,11 @@ export const TypedStaffMemberDeleteMutation = TypedMutation< >(staffMemberDeleteMutation); const staffAvatarUpdateMutation = gql` + ${accountFragmentError} mutation StaffAvatarUpdate($image: Upload!) { userAvatarUpdate(image: $image) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { id @@ -100,11 +101,11 @@ export const TypedStaffAvatarUpdateMutation = TypedMutation< >(staffAvatarUpdateMutation); const staffAvatarDeleteMutation = gql` + ${accountFragmentError} mutation StaffAvatarDelete { userAvatarDelete { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } user { id @@ -121,11 +122,11 @@ export const TypedStaffAvatarDeleteMutation = TypedMutation< >(staffAvatarDeleteMutation); const changeStaffPassword = gql` + ${accountFragmentError} mutation ChangeStaffPassword($newPassword: String!, $oldPassword: String!) { passwordChange(newPassword: $newPassword, oldPassword: $oldPassword) { - errors { - field - message + errors: accountErrors { + ...AccountErrorFragment } } } diff --git a/src/staff/types/ChangeStaffPassword.ts b/src/staff/types/ChangeStaffPassword.ts index 0913c8d27..5df09fe97 100644 --- a/src/staff/types/ChangeStaffPassword.ts +++ b/src/staff/types/ChangeStaffPassword.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: ChangeStaffPassword // ==================================================== export interface ChangeStaffPassword_passwordChange_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface ChangeStaffPassword_passwordChange { diff --git a/src/staff/types/StaffAvatarDelete.ts b/src/staff/types/StaffAvatarDelete.ts index b92267979..0d74345e7 100644 --- a/src/staff/types/StaffAvatarDelete.ts +++ b/src/staff/types/StaffAvatarDelete.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: StaffAvatarDelete // ==================================================== export interface StaffAvatarDelete_userAvatarDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface StaffAvatarDelete_userAvatarDelete_user_avatar { diff --git a/src/staff/types/StaffAvatarUpdate.ts b/src/staff/types/StaffAvatarUpdate.ts index c58029384..4b0746ad5 100644 --- a/src/staff/types/StaffAvatarUpdate.ts +++ b/src/staff/types/StaffAvatarUpdate.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: StaffAvatarUpdate // ==================================================== export interface StaffAvatarUpdate_userAvatarUpdate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface StaffAvatarUpdate_userAvatarUpdate_user_avatar { diff --git a/src/staff/types/StaffMemberAdd.ts b/src/staff/types/StaffMemberAdd.ts index 214102425..fadf8bb7b 100644 --- a/src/staff/types/StaffMemberAdd.ts +++ b/src/staff/types/StaffMemberAdd.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { StaffCreateInput, PermissionEnum } from "./../../types/globalTypes"; +import { StaffCreateInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: StaffMemberAdd // ==================================================== export interface StaffMemberAdd_staffCreate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface StaffMemberAdd_staffCreate_user_avatar { diff --git a/src/staff/types/StaffMemberDelete.ts b/src/staff/types/StaffMemberDelete.ts index f90ba0d03..8bf44db45 100644 --- a/src/staff/types/StaffMemberDelete.ts +++ b/src/staff/types/StaffMemberDelete.ts @@ -2,14 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. +import { AccountErrorCode } from "./../../types/globalTypes"; + // ==================================================== // GraphQL mutation operation: StaffMemberDelete // ==================================================== export interface StaffMemberDelete_staffDelete_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface StaffMemberDelete_staffDelete { diff --git a/src/staff/types/StaffMemberUpdate.ts b/src/staff/types/StaffMemberUpdate.ts index 88f3881a2..aabd8ef74 100644 --- a/src/staff/types/StaffMemberUpdate.ts +++ b/src/staff/types/StaffMemberUpdate.ts @@ -2,16 +2,16 @@ /* eslint-disable */ // This file was automatically generated and should not be edited. -import { StaffInput, PermissionEnum } from "./../../types/globalTypes"; +import { StaffInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: StaffMemberUpdate // ==================================================== export interface StaffMemberUpdate_staffUpdate_errors { - __typename: "Error"; + __typename: "AccountError"; + code: AccountErrorCode; field: string | null; - message: string | null; } export interface StaffMemberUpdate_staffUpdate_user_avatar { diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 67e140b83..ec11c64f4 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -6,6 +6,28 @@ // START Enums and Input Objects //============================================================== +export enum AccountErrorCode { + ACTIVATE_OWN_ACCOUNT = "ACTIVATE_OWN_ACCOUNT", + ACTIVATE_SUPERUSER_ACCOUNT = "ACTIVATE_SUPERUSER_ACCOUNT", + ASSIGN_NON_STAFF_MEMBER = "ASSIGN_NON_STAFF_MEMBER", + DEACTIVATE_OWN_ACCOUNT = "DEACTIVATE_OWN_ACCOUNT", + DEACTIVATE_SUPERUSER_ACCOUNT = "DEACTIVATE_SUPERUSER_ACCOUNT", + DELETE_NON_STAFF_USER = "DELETE_NON_STAFF_USER", + DELETE_OWN_ACCOUNT = "DELETE_OWN_ACCOUNT", + DELETE_STAFF_ACCOUNT = "DELETE_STAFF_ACCOUNT", + DELETE_SUPERUSER_ACCOUNT = "DELETE_SUPERUSER_ACCOUNT", + GRAPHQL_ERROR = "GRAPHQL_ERROR", + INVALID = "INVALID", + INVALID_PASSWORD = "INVALID_PASSWORD", + NOT_FOUND = "NOT_FOUND", + PASSWORD_ENTIRELY_NUMERIC = "PASSWORD_ENTIRELY_NUMERIC", + PASSWORD_TOO_COMMON = "PASSWORD_TOO_COMMON", + PASSWORD_TOO_SHORT = "PASSWORD_TOO_SHORT", + PASSWORD_TOO_SIMILAR = "PASSWORD_TOO_SIMILAR", + REQUIRED = "REQUIRED", + UNIQUE = "UNIQUE", +} + export enum AddressTypeEnum { BILLING = "BILLING", SHIPPING = "SHIPPING",