{"action":"created","issue":{"url":"https://api.github.com/repos/agraboso/redux-api-middleware/issues/105","repository_url":"https://api.github.com/repos/agraboso/redux-api-middleware","labels_url":"https://api.github.com/repos/agraboso/redux-api-middleware/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/agraboso/redux-api-middleware/issues/105/comments","events_url":"https://api.github.com/repos/agraboso/redux-api-middleware/issues/105/events","html_url":"https://github.com/agraboso/redux-api-middleware/issues/105","id":179496311,"number":105,"title":"How to use redux-api-middleware with redux-thunk?","user":{"login":"jinxac","id":15068096,"avatar_url":"https://avatars.githubusercontent.com/u/15068096?v=3","gravatar_id":"","url":"https://api.github.com/users/jinxac","html_url":"https://github.com/jinxac","followers_url":"https://api.github.com/users/jinxac/followers","following_url":"https://api.github.com/users/jinxac/following{/other_user}","gists_url":"https://api.github.com/users/jinxac/gists{/gist_id}","starred_url":"https://api.github.com/users/jinxac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinxac/subscriptions","organizations_url":"https://api.github.com/users/jinxac/orgs","repos_url":"https://api.github.com/users/jinxac/repos","events_url":"https://api.github.com/users/jinxac/events{/privacy}","received_events_url":"https://api.github.com/users/jinxac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-27T13:41:53Z","updated_at":"2016-11-16T07:53:51Z","closed_at":null,"body":"I was trying to use redux-thunk with redux-api-middleware. \n\nSo what I am trying to do is that with ``withExtraArgument` I am injecting my api into thunk.Following is the code for that:-\n\n```\nimport { createStore, applyMiddleware, compose } from 'redux'\nimport { apiMiddleware } from 'redux-api-middleware';\nimport api from '../middlewares/api.js'\nimport thunk from 'redux-thunk'\nimport rootReducer from '../reducers/index'\n\nexport default function configureStore(initialState) {\n  const store=createStore(\n    rootReducer,\n    initialState,\n    compose(\n      applyMiddleware(apiMiddleware,thunk.withExtraArgument(api))))\n  return store\n}\n```\n\nNow my middleware api is as follows:-\n\n```\nimport { CALL_API } from 'redux-api-middleware';\n\nexport default function api(url,method,actions){\n  return {\n    [CALL_API] : {\n      endpoint : 'https://jsonplaceholder.typicode.com/users',\n      method : 'GET',\n      types: ['REQUEST_USER_DATA','RECEIVE_USER_DATA','FAILURE_USER_DATA']\n    }\n  }\n}\n\n```\n\nMy action is :- \n\nexport function fetchUserData(){\n\n```\n  return (dispatch,getState,api) => {\n    const url = 'https://jsonplaceholder.typicode.com/users/';\n    const method = 'GET'\n    const actionTypes = ['REQUEST_USER_DATA','RECEIVE_USER_DATA','FAILURE_USER_DATA']\n    api(url,method,actionTypes)\n  }\n}\n\n```\n\nSo this does not seem to be working. I cannot see any API calls getting fired. Am I doing something wrong? How do I make this work?\n\nI want a middleware which takes care of all my all my requests and i was planning to use redux-api-middleware for that.\n"},"comment":{"url":"https://api.github.com/repos/agraboso/redux-api-middleware/issues/comments/260877962","html_url":"https://github.com/agraboso/redux-api-middleware/issues/105#issuecomment-260877962","issue_url":"https://api.github.com/repos/agraboso/redux-api-middleware/issues/105","id":260877962,"user":{"login":"MrOggy85","id":2677573,"avatar_url":"https://avatars.githubusercontent.com/u/2677573?v=3","gravatar_id":"","url":"https://api.github.com/users/MrOggy85","html_url":"https://github.com/MrOggy85","followers_url":"https://api.github.com/users/MrOggy85/followers","following_url":"https://api.github.com/users/MrOggy85/following{/other_user}","gists_url":"https://api.github.com/users/MrOggy85/gists{/gist_id}","starred_url":"https://api.github.com/users/MrOggy85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrOggy85/subscriptions","organizations_url":"https://api.github.com/users/MrOggy85/orgs","repos_url":"https://api.github.com/users/MrOggy85/repos","events_url":"https://api.github.com/users/MrOggy85/events{/privacy}","received_events_url":"https://api.github.com/users/MrOggy85/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T07:53:51Z","updated_at":"2016-11-16T07:53:51Z","body":"I don't think you miss a return statement, but rather dispatching the result of api, like this:\r\n `dispatch(api(url,method,actionTypes))`"}}
{"actor":{"display_login":"MrOggy85"}}