@@ -333,7 +333,7 @@ export function loadPosts(userId) {
333
333
// Types of actions to emit before and after
334
334
types: [' LOAD_POSTS_REQUEST' , ' LOAD_POSTS_SUCCESS' , ' LOAD_POSTS_FAILURE' ],
335
335
// Check the cache (optional):
336
- shouldCallAPI : (state ) => ! state .users [userId],
336
+ shouldCallAPI : (state ) => ! state .posts [userId],
337
337
// Perform the fetching:
338
338
callAPI : () => fetch (` http://myapi.com/users/${ userId} /posts` ),
339
339
// Arguments to inject in begin/end actions
@@ -403,7 +403,7 @@ After passing it once to [`applyMiddleware(...middlewares)`](../api/applyMiddlew
403
403
export function loadPosts (userId ) {
404
404
return {
405
405
types: [' LOAD_POSTS_REQUEST' , ' LOAD_POSTS_SUCCESS' , ' LOAD_POSTS_FAILURE' ],
406
- shouldCallAPI : (state ) => ! state .users [userId],
406
+ shouldCallAPI : (state ) => ! state .posts [userId],
407
407
callAPI : () => fetch (` http://myapi.com/users/${ userId} /posts` ),
408
408
payload: { userId }
409
409
}
@@ -412,7 +412,7 @@ export function loadPosts(userId) {
412
412
export function loadComments (postId ) {
413
413
return {
414
414
types: [' LOAD_COMMENTS_REQUEST' , ' LOAD_COMMENTS_SUCCESS' , ' LOAD_COMMENTS_FAILURE' ],
415
- shouldCallAPI : (state ) => ! state .posts [postId],
415
+ shouldCallAPI : (state ) => ! state .comments [postId],
416
416
callAPI : () => fetch (` http://myapi.com/posts/${ postId} /comments` ),
417
417
payload: { postId }
418
418
}
0 commit comments