Same .me format for providers; CORS for Genius

This commit is contained in:
James Barnsley
2018-08-17 16:09:36 +12:00
parent d48cdd9f45
commit b9f53d8d83
12 changed files with 211 additions and 64 deletions

View File

@ -0,0 +1,39 @@
var helpers = require('./../../helpers')
var coreActions = require('../core/actions')
const GeniusMiddleware = (function(){
return store => next => action => {
var state = store.getState();
switch(action.type){
case 'GENIUS_ME_LOADED':
store.dispatch({
type: 'GENIUS_USER_LOADED',
user: action.me
});
next(action);
break;
case 'GENIUS_USER_LOADED':
var user = Object.assign(
{},
action.user,
{
uri: "genius:user:"+action.user.id
}
);
store.dispatch(coreActions.userLoaded(user));
next(action);
break;
// This action is irrelevant to us, pass it on to the next middleware
default:
return next(action);
}
}
})();
export default GeniusMiddleware