fix: คำนวนหน้าผิด

This commit is contained in:
Net 2024-06-12 15:36:36 +07:00
parent dc2507d5a6
commit 069dcce9b6

View file

@ -4,15 +4,11 @@ import AppBox from 'components/app/AppBox.vue';
import BranchCardCustomer from 'components/03_customer-management/BranchCardCustomer.vue';
import { onMounted } from 'vue';
import useCustomerStore from 'src/stores/customer';
import {
CustomerBranch,
Customer,
CustomerType,
} from 'src/stores/customer/types';
import { CustomerBranch, CustomerType } from 'src/stores/customer/types';
import { watch } from 'vue';
const userCustomer = useCustomerStore();
const { fetchListById, fetchListBranch } = userCustomer;
const { fetchListBranch } = userCustomer;
const inputSearch = ref<string>('');
@ -63,19 +59,21 @@ onMounted(async () => {
});
if (result) {
currentCustomerName.value = 'dasd';
maxPageBranch.value = Math.ceil(result.total / pageSizeBranch.value);
branch.value = result.result;
}
});
watch(currentPageBranch, async () => {
const resultList = await fetchListBranch({
customerId: prop.customerId,
page: currentPageBranch.value,
pageSize: pageSizeBranch.value,
});
if (resultList) {
currentPageBranch.value = resultList.page;
maxPageBranch.value = Math.ceil(resultList.total / pageSizeBranch.value);
branch.value = resultList.result;
}