File tree Expand file tree Collapse file tree
libs/ngrx-toolkit/src/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,14 +118,25 @@ function createMutationsFeature<Result extends MutationsDictionary>(
118118 keys . reduce (
119119 ( acc , key ) => ( {
120120 ...acc ,
121- [ key ] : async ( params : never ) => {
122- const mutation = mutations [ key ] ;
123- if ( ! mutation ) {
124- throw new Error ( `Mutation ${ key } not found` ) ;
125- }
126- const result = await mutation ( params ) ;
127- return result ;
128- } ,
121+ [ key ] : Object . assign (
122+ async ( params : never ) => {
123+ const mutation = mutations [ key ] ;
124+ if ( ! mutation ) {
125+ throw new Error ( `Mutation ${ key } not found` ) ;
126+ }
127+ const result = await mutation ( params ) ;
128+
129+ return result ;
130+ } ,
131+ {
132+ status : mutations [ key ] . status ,
133+ value : mutations [ key ] . value ,
134+ isPending : mutations [ key ] . isPending ,
135+ isSuccess : mutations [ key ] . isSuccess ,
136+ error : mutations [ key ] . error ,
137+ hasValue : mutations [ key ] . hasValue ,
138+ } ,
139+ ) ,
129140 } ) ,
130141 { } as MethodsDictionary ,
131142 ) ,
You can’t perform that action at this time.
0 commit comments