mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
25 lines
536 B
JavaScript
25 lines
536 B
JavaScript
|
'use strict';
|
||
|
|
||
|
import requests from '../utils/requests';
|
||
|
import UserActions from '../actions/user_actions';
|
||
|
|
||
|
|
||
|
const UserSource = {
|
||
|
fetchUser: {
|
||
|
remote() {
|
||
|
return requests.get('user');
|
||
|
},
|
||
|
|
||
|
local(state) {
|
||
|
return state.currentUser && state.currentUser.email ? state.currentUser : {};
|
||
|
},
|
||
|
|
||
|
success: UserActions.receiveCurrentUser,
|
||
|
|
||
|
shouldFetch(state) {
|
||
|
return state.currentUser && !state.currentUser.email;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
export default UserSource;
|