File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,12 @@ httpMutation({
143143
144144### Callbacks
145145
146- In the mutation: _optional_ ` onSuccess ` and ` onError ` callbacks
146+ In the mutation: _optional_ ` onSuccess ` and ` onError ` callbacks.
147+
148+ The callbacks are called with two parameters:
149+
150+ 1. The result of the mutation ( ` onSuccess ` ) or the error ( ` onError ` )
151+ 2. The parameter passed when calling the mutation
147152
148153` ` ` ts
149154({
@@ -159,6 +164,14 @@ In the mutation: _optional_ `onSuccess` and `onError` callbacks
159164 console .error (' Error occurred:' , error );
160165 },
161166});
167+
168+ // using the passed parameter
169+ ({
170+ onSuccess : (_result , params ) => {
171+ // after successful deletion
172+ store .listResource .set (store .listResource .value ().filter ((item ) => item .id !== params .id ));
173+ },
174+ });
162175```
163176
164177### Flattening operators
You can’t perform that action at this time.
0 commit comments