summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/releases/components/releases_pagination_rest.vue
blob: 334458a23025883677315ffbfbb8b46da9a21d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script>
import { mapActions, mapState } from 'vuex';
import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue';
import { historyPushState, buildUrlWithCurrentLocation } from '~/lib/utils/common_utils';

export default {
  name: 'ReleasesPaginationRest',
  components: { TablePagination },
  computed: {
    ...mapState('list', ['restPageInfo']),
  },
  methods: {
    ...mapActions('list', ['fetchReleases']),
    onChangePage(page) {
      historyPushState(buildUrlWithCurrentLocation(`?page=${page}`));
      this.fetchReleases({ page });
    },
  },
};
</script>

<template>
  <table-pagination :change="onChangePage" :page-info="restPageInfo" />
</template>