Skip to content

Commit 3fc3e66

Browse files
authored
Merge pull request #52 from madscience/fix/mutation-client
fix: set client from $apollo correctly in mutateWithErrorHandling
2 parents 75679dc + 2a24bab commit 3fc3e66

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
export * from './ApolloErrorProcessor';
6+
export * from './handleApolloError';
67
export * from './mutation';
78
export * from './query';
89
export * from './subscription';

src/mutation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ export async function mutateWithErrorHandling<
9090
client?: ApolloMutationClient<TResult, TVariables>,
9191
): Promise<MutationResult<TResult>> {
9292
const mutate =
93-
client === undefined ? app.$apollo : typeof client === 'function' ? client : client.mutate.bind(client);
93+
client === undefined
94+
? app.$apollo.mutate.bind(app.$apollo)
95+
: typeof client === 'function'
96+
? client
97+
: client.mutate.bind(client);
9498

9599
try {
96100
const result = await mutate({

0 commit comments

Comments
 (0)