2015-07-24 17:52:07 -07:00
|
|
|
import { Actions } from 'thundercats';
|
|
|
|
|
|
|
|
|
|
|
|
export default Actions({
|
2015-12-22 19:33:25 -08:00
|
|
|
shouldBindMethods: true,
|
|
|
|
refs: { displayName: 'AppActions' },
|
|
|
|
|
2015-07-29 10:16:48 -07:00
|
|
|
setTitle(title = 'Learn To Code') {
|
2015-12-22 19:33:25 -08:00
|
|
|
return { title: title + ' | Free Code Camp' };
|
2015-07-29 10:16:48 -07:00
|
|
|
},
|
|
|
|
|
2015-12-22 19:33:25 -08:00
|
|
|
getUser({ isPrimed }) {
|
|
|
|
if (isPrimed) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.readService$('user', null, null)
|
2016-01-05 10:11:10 -08:00
|
|
|
.map(({
|
2015-12-22 19:33:25 -08:00
|
|
|
username,
|
|
|
|
picture,
|
|
|
|
progressTimestamps = [],
|
|
|
|
isFrontEndCert,
|
|
|
|
isFullStackCert
|
2016-01-05 10:11:10 -08:00
|
|
|
}) => {
|
2015-12-22 19:33:25 -08:00
|
|
|
return {
|
|
|
|
username,
|
|
|
|
picture,
|
|
|
|
points: progressTimestamps.length,
|
|
|
|
isFrontEndCert,
|
|
|
|
isFullStackCert
|
|
|
|
};
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.error(err);
|
|
|
|
});
|
2015-07-24 17:52:07 -07:00
|
|
|
},
|
2015-07-29 10:16:48 -07:00
|
|
|
|
2015-12-31 17:39:29 -08:00
|
|
|
// routing
|
|
|
|
goTo: null,
|
|
|
|
goBack: null,
|
|
|
|
updateLocation(location) {
|
|
|
|
return {
|
|
|
|
transform(state) {
|
|
|
|
return { ...state, location };
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2015-12-22 19:33:25 -08:00
|
|
|
});
|