svrcekmichal / redux-axios-middleware

Redux middleware for fetching data with axios HTTP client
MIT License
922 stars 96 forks source link

Cannot read property 'request' of undefined #94

Open banmarkovic opened 5 years ago

banmarkovic commented 5 years ago

Anyone encountered this problem while trying to connect redux, axios and redux-axios-middleware in ReactNative app? For some reason I keep getting this error, it seems like something is wrong with function loginWebservice(username, password) { return { type: LOGIN, payload: { request: { url: '/auth/login', method: 'POST', data: { 'name': username, 'password': password } } } } }

I configured axios client and I connected it with redux store.

Also error another error I received is undentified is not an object (evaluating 'setupClient.client.request')

colinux commented 5 years ago

I had a similar problem in a multi client configuration one day because my import was wrong :

// OK :
import { multiClientMiddleware } from 'redux-axios-middleware'; 

// This won't work because this imports the default module, which behaves slightly differently 
import multiClientMiddleware from 'redux-axios-middleware'; 
tangbao commented 6 months ago

I had a similar problem in a multi client configuration one day because my import was wrong :

// OK :
import { multiClientMiddleware } from 'redux-axios-middleware'; 

// This won't work because this imports the default module, which behaves slightly differently 
import multiClientMiddleware from 'redux-axios-middleware'; 

Thanks, this is helpful