add: pagination of users
This commit is contained in:
@@ -19,7 +19,7 @@ import Pagination from '../components/Pagination.vue';
|
||||
getInitData();
|
||||
})
|
||||
|
||||
const limit = 10;
|
||||
const limit = 3;
|
||||
|
||||
const getInitData = async() => {
|
||||
loading.value = true;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import CardUser from '../components/CardUser.vue';
|
||||
import { useCompanyStore } from '../stores/company';
|
||||
import CreateUserModal from '../components/CreateUserModal.vue';
|
||||
import Pagination from '../components/Pagination.vue';
|
||||
|
||||
const companyStore = useCompanyStore();
|
||||
|
||||
@@ -13,11 +14,20 @@
|
||||
|
||||
const currentUser = ref(null);
|
||||
const openModal = ref(false);
|
||||
const limit = 3;
|
||||
|
||||
const getInitData = async() => {
|
||||
console.log('callll')
|
||||
loading.value = true;
|
||||
await companyStore.getUsersCompany();
|
||||
await companyStore.getUsersCompany(limit);
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const getUsersByPage = async(data) => {
|
||||
console.log(data)
|
||||
loading.value = true;
|
||||
companyStore.usersCurrentPage = data.page
|
||||
await companyStore.getUsersCompany(limit, data.skip, true);
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
@@ -61,6 +71,12 @@
|
||||
:readonly="false"
|
||||
@set-user="handleSetCurrentUser(user)"
|
||||
/>
|
||||
<Pagination
|
||||
:limit="limit"
|
||||
:total="companyStore.usersTotal"
|
||||
:current-page="companyStore.usersCurrentPage"
|
||||
@get-elements="getUsersByPage"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
loading.value = true;
|
||||
filterQuery.value.company = "company="+ localStorage.getItem('id');
|
||||
await vehicleStore.fetchVehicles(filterQuery.value, false);
|
||||
await companyStore.getUsersCompany();
|
||||
await companyStore.getDrivers();
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user