mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 21:52:08 +02:00
35 lines
792 B
JavaScript
35 lines
792 B
JavaScript
'use strict';
|
|
|
|
import { altUser } from '../alt';
|
|
import UserActions from '../actions/user_actions';
|
|
|
|
import UserSource from '../sources/user_source';
|
|
|
|
// import AscribeStorage from '../models/ascribe_storage';
|
|
// import { sessionStorageAvailable } from '../utils/feature_detection_utils';
|
|
|
|
|
|
class UserStore {
|
|
constructor() {
|
|
this.currentUser = {};
|
|
this.bindActions(UserActions);
|
|
this.registerAsync(UserSource);
|
|
}
|
|
|
|
onFetchCurrentUser() {
|
|
if(!this.getInstance().isLoading()) {
|
|
this.getInstance().fetchUser();
|
|
}
|
|
}
|
|
|
|
onReceiveCurrentUser({users: [user]}) {
|
|
this.currentUser = user;
|
|
}
|
|
|
|
onDeleteCurrentUser() {
|
|
this.currentUser = {};
|
|
}
|
|
}
|
|
|
|
export default altUser.createStore(UserStore, 'UserStore');
|