16 lines
445 B
JavaScript
16 lines
445 B
JavaScript
|
import { CALL_API, isRSAA } from 'redux-api-middleware';
|
||
|
|
||
|
export default store => next => action => {
|
||
|
if (!isRSAA(action)) {
|
||
|
return next(action);
|
||
|
}
|
||
|
|
||
|
const TOKEN = store.getState().user.get('token');
|
||
|
if (TOKEN) {
|
||
|
action[CALL_API].endpoint = action[CALL_API].endpoint.query('circle-token', TOKEN );
|
||
|
}
|
||
|
|
||
|
action[CALL_API].endpoint = action[CALL_API].endpoint.toString(); // COnvert url object to string
|
||
|
return next(action);
|
||
|
};
|