Skip to content

Commit

Permalink
Include duration in success/failure action payloads (#92)
Browse files Browse the repository at this point in the history
* Include duration in success/failure action payloads

* Update actions/index.js
  • Loading branch information
blazzy authored and ryanashcraft committed Dec 6, 2017
1 parent 29ba274 commit 5fe28e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const requestStart = ({ body, meta, networkHandler, queryKey, url }) => {

export const requestSuccess = ({
body,
duration,
entities,
meta,
queryKey,
Expand All @@ -26,6 +27,7 @@ export const requestSuccess = ({
type: actionTypes.REQUEST_SUCCESS,
url,
body,
duration,
status,
entities,
responseBody,
Expand All @@ -39,6 +41,7 @@ export const requestSuccess = ({

export const requestFailure = ({
body,
duration,
meta,
queryKey,
responseBody,
Expand All @@ -51,6 +54,7 @@ export const requestFailure = ({
type: actionTypes.REQUEST_FAILURE,
url,
body,
duration,
status,
responseBody,
responseText,
Expand All @@ -75,6 +79,7 @@ export const mutateStart = ({ body, meta, networkHandler, optimisticEntities, qu

export const mutateSuccess = ({
body,
duration,
entities,
meta,
queryKey,
Expand All @@ -88,6 +93,7 @@ export const mutateSuccess = ({
type: actionTypes.MUTATE_SUCCESS,
url,
body,
duration,
status,
responseBody,
responseText,
Expand All @@ -101,6 +107,7 @@ export const mutateSuccess = ({

export const mutateFailure = ({
body,
duration,
meta,
queryKey,
responseBody,
Expand All @@ -114,6 +121,7 @@ export const mutateFailure = ({
type: actionTypes.MUTATE_FAILURE,
url,
body,
duration,
status,
responseBody,
responseText,
Expand Down
4 changes: 4 additions & 0 deletions src/middleware/query-advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const queryMiddlewareAdvanced = networkInterface => (
dispatch(
requestFailure({
body,
duration,
meta,
queryKey,
responseBody,
Expand All @@ -153,6 +154,7 @@ const queryMiddlewareAdvanced = networkInterface => (
dispatch(
requestSuccess({
body,
duration,
meta,
entities: newEntities,
queryKey,
Expand Down Expand Up @@ -251,6 +253,7 @@ const queryMiddlewareAdvanced = networkInterface => (
dispatch(
mutateFailure({
body,
duration,
meta,
queryKey,
responseBody,
Expand All @@ -277,6 +280,7 @@ const queryMiddlewareAdvanced = networkInterface => (
mutateSuccess({
url,
body,
duration,
status,
entities: newEntities,
queryKey,
Expand Down

0 comments on commit 5fe28e8

Please sign in to comment.