2015-07-24 17:52:07 -07:00
|
|
|
import { Store } from 'thundercats';
|
|
|
|
|
2015-07-29 10:16:48 -07:00
|
|
|
const { createRegistrar, setter, fromMany } = Store;
|
2015-07-24 17:52:07 -07:00
|
|
|
const initValue = {
|
2015-07-29 10:16:48 -07:00
|
|
|
title: 'Learn To Code | Free Code Camp',
|
2015-07-24 17:52:07 -07:00
|
|
|
username: null,
|
|
|
|
picture: null,
|
|
|
|
points: 0
|
|
|
|
};
|
|
|
|
|
2015-10-11 15:57:49 -07:00
|
|
|
export default Store({
|
|
|
|
refs: {
|
|
|
|
displayName: 'AppStore',
|
|
|
|
value: initValue
|
|
|
|
},
|
|
|
|
init({ instance: appStore, args: [cat] }) {
|
2015-10-27 20:07:28 -07:00
|
|
|
const { goTo, setUser, setTitle } = cat.getActions('appActions');
|
2015-07-24 17:52:07 -07:00
|
|
|
const register = createRegistrar(appStore);
|
2015-07-29 10:16:48 -07:00
|
|
|
|
2015-10-27 20:07:28 -07:00
|
|
|
register(setter(fromMany(setUser, setTitle, goTo)));
|
2015-07-24 17:52:07 -07:00
|
|
|
|
|
|
|
return appStore;
|
2015-10-11 15:57:49 -07:00
|
|
|
}
|
|
|
|
});
|