17 lines
549 B
JavaScript
17 lines
549 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');
|
|
console.log('GOT TOKEN', TOKEN);
|
|
if (TOKEN) {
|
|
action[CALL_API].endpoint = action[CALL_API].endpoint.query('circle-token', TOKEN );
|
|
console.log('SET URL TO', action[CALL_API].endpoint.toString());
|
|
}
|
|
|
|
action[CALL_API].endpoint = action[CALL_API].endpoint.toString(); // COnvert url object to string
|
|
return next(action);
|
|
};
|