Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 Pagination issue resolved #53

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ declare module 'vue' {
Navbar: typeof import('./components/Navbar.vue')['default']
NBadge: typeof import('naive-ui')['NBadge']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NColorPicker: typeof import('naive-ui')['NColorPicker']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDataTable: typeof import('naive-ui')['NDataTable']
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NIcon: typeof import('naive-ui')['NIcon']
Expand All @@ -42,15 +41,10 @@ declare module 'vue' {
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
NPageHeader: typeof import('naive-ui')['NPageHeader']
NPopselect: typeof import('naive-ui')['NPopselect']
NSelect: typeof import('naive-ui')['NSelect']
NSpace: typeof import('naive-ui')['NSpace']
NSwitch: typeof import('naive-ui')['NSwitch']
NTreeSelect: typeof import('naive-ui')['NTreeSelect']
NUpload: typeof import('naive-ui')['NUpload']
OrderManagement: typeof import('./components/Orders/OrderManagement.vue')['default']
ProductsManagement: typeof import('./components/Products/ProductsManagement.vue')['default']
ReviewManagement: typeof import('./components/Review/ReviewManagement.vue')['default']
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/handlers/color.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { faker } from '@faker-js/faker'
import { CreatePagedResponse } from '../handlers.utility'
import type { Color, ColorCreateModel } from '~/models/Color'

const colors = _.times(7, createFakeColor)
const colors = _.times(17, createFakeColor)
const handlers = [
http.get('/api/Color', ({ request }) => {
const response = CreatePagedResponse<Color>(request, colors)
Expand Down
2 changes: 1 addition & 1 deletion src/store/brand.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useBrandStore = defineStore('Brand', () => {
try {
const response = await brandService.getList(options)
brands.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.itemsPerPage)
}
finally {
isLoading.value = false
Expand Down
2 changes: 1 addition & 1 deletion src/store/category.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useCategoryStore = defineStore('Category', () => {
try {
const response = await categoryService.getList(options)
categories.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.itemsPerPage)
}
finally {
isLoading.value = false
Expand Down
2 changes: 1 addition & 1 deletion src/store/color.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useColorStore = defineStore('Color', () => {
try {
const response = await colorService.getList(options)
colors.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.pageSize)
}
finally {
isLoading.value = false
Expand Down
2 changes: 1 addition & 1 deletion src/store/customer.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useCustomerStore = defineStore('Customer', () => {
try {
const response = await customerService.getList(options)
customers.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.itemsPerPage)
}
finally {
isLoading.value = false
Expand Down
2 changes: 1 addition & 1 deletion src/store/order.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
try {
const response = await orderService.getOrderList(options)
orders.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.itemsPerPage)
}
finally {
isLoading.value = false
Expand All @@ -22,7 +22,7 @@
}

async function getOrderDetail(order: Order) {
const response = await orderService.getOrder(order.id)

Check failure on line 25 in src/store/order.store.ts

View workflow job for this annotation

GitHub Actions / typecheck

'response' is declared but its value is never read.

Check warning on line 25 in src/store/order.store.ts

View workflow job for this annotation

GitHub Actions / lint

'response' is assigned a value but never used. Allowed unused vars must match /^_/u
}

return {
Expand Down
2 changes: 1 addition & 1 deletion src/store/product.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useProductStore = defineStore('Product', () => {
try {
const response = await productService.getList(options)
products.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.itemsPerPage)
}
finally {
isLoading.value = false
Expand Down
2 changes: 1 addition & 1 deletion src/store/review.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useReviewStore = defineStore('Review', () => {
try {
const response = await reviewService.getReviewList(options)
reviews.value = response.items
options.pageSize = Math.trunc(response.totalCount / options.itemsPerPage)
options.pageCount = Math.ceil(response.totalCount / options.itemsPerPage)
}
finally {
isLoading.value = false
Expand Down
Loading