Skip to content

Commit

Permalink
feat: load more activities (#5973)
Browse files Browse the repository at this point in the history
  • Loading branch information
sktlmarat authored Mar 8, 2022
1 parent f305e85 commit 117fe19
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions resources/js/components/people/activity/ActivityList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
@cancel="$set(activity, 'edit', false); displayLogActivity = false"
/>
</div>
<a v-if="!isLastPage" class="pointer mr1" style="float: right" @click.prevent="getActivities">
{{ $t('app.load_more') }}
</a>
</div>

<p v-if="activities.length > 0" class="tc">
Expand Down Expand Up @@ -175,12 +178,17 @@ export default {
displayParticipants: false,
destroyActivityId: 0,
errors: [],
currentPage: 0,
lastPage: null
};
},
computed: {
dirltr() {
return this.$root.htmldir === 'ltr';
},
isLastPage () {
return this.lastPage === this.currentPage;
}
},
Expand All @@ -199,9 +207,12 @@ export default {
},
getActivities() {
axios.get(`people/${this.hash}/activities`)
this.currentPage++;
axios.get('api/contacts/' + this.contactId + '/activities?page=' + this.currentPage)
.then(response => {
this.activities = response.data.data;
this.activities.push(...response.data.data);
this.currentPage = response.data.meta.current_page;
this.lastPage = response.data.meta.last_page;
});
},
Expand Down

0 comments on commit 117fe19

Please sign in to comment.