Skip to content

Commit

Permalink
fix(useMutation): Make payload argument optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomaszewski committed Apr 19, 2021
1 parent 75a0184 commit 5d0cf4e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/ra-core/src/dataProvider/useMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const useMutation = (
export interface Mutation {
type: string;
resource?: string;
payload: object;
payload?: object;
}

export interface MutationOptions {
Expand Down Expand Up @@ -281,7 +281,12 @@ const mergeDefinitionAndCallTimeParameters = (
callTimeQuery?: Mutation | Event,
options?: MutationOptions,
callTimeOptions?: MutationOptions
) => {
): {
type: string;
resource: string;
payload?: object;
options: MutationOptions;
} => {
if (!query && (!callTimeQuery || callTimeQuery instanceof Event)) {
throw new Error('Missing query either at definition or at call time');
}
Expand Down

0 comments on commit 5d0cf4e

Please sign in to comment.