TS
export const useErrorMessage = (error) => {let errorMessage = null;if (!error || !error.message) return null;if (error.networkError && error.networkError.result && error.networkError.result.errors.length) {errorMessage = error.networkError.result.errors.map((error, i) =>error.message.replace('GraphQL error: ', ''));}errorMessage = error.message.replace('GraphQL error: ', '');return errorMessage;};
useErrorMessage
Handle graphql errors, or at least get the message from your requests