Rewrite FollowList using hocs

This commit is contained in:
taehoon 2019-02-25 04:51:23 -05:00
parent cb383df517
commit 080786c945
6 changed files with 45 additions and 116 deletions

View file

@ -7,6 +7,7 @@ import './with_load_more.scss'
const withLoadMore = ({
fetch, // function to fetch entries and return a promise
select, // function to select data from store
destroy, // function called at "destroyed" lifecycle
childPropName = 'entries', // name of the prop to be passed into the wrapped component
additionalPropNames = [] // additional prop name list of the wrapper component
}) => (WrappedComponent) => {
@ -58,6 +59,7 @@ const withLoadMore = ({
},
destroyed () {
window.removeEventListener('scroll', this.scrollLoad)
destroy && destroy(this.$props, this.$store)
},
methods: {
fetchEntries () {