fix: pagination on all page

This commit is contained in:
caturbgs
2021-12-22 22:15:04 +07:00
parent 3bce86ea5f
commit 1e92eee5b5
7 changed files with 60 additions and 68 deletions

View File

@@ -1,23 +1,11 @@
import React, { useContext, useEffect, useState } from "react";
import {
Button,
Form,
Input,
message,
Modal,
Select,
Space,
Table,
Tag,
List,
Divider,
} from "antd";
import { observer } from "mobx-react-lite";
import { ExclamationCircleOutlined } from "@ant-design/icons";
import { useHistory } from "react-router-dom";
import { useStore } from "../utils/useStore";
import { LINKS } from "../routes/app";
import { ModalLoaderContext } from "../utils/modal";
import React, {useContext, useState} from "react";
import {Button, Divider, Form, Input, List, message, Modal, Space, Table, Tag,} from "antd";
import {observer} from "mobx-react-lite";
import {ExclamationCircleOutlined} from "@ant-design/icons";
import {useHistory} from "react-router-dom";
import {useStore} from "../utils/useStore";
import {LINKS} from "../routes/app";
import {ModalLoaderContext} from "../utils/modal";
export const PartnerComponent = observer((props) => {
const store = useStore();
@@ -223,15 +211,15 @@ export const PartnerComponent = observer((props) => {
pagination={{
onChange: async (page) => {
store.partner.pageSize = page.pageSize;
store.partner.page = page.current;
store.partner.page = page.current - 1;
modalLoader.setLoading(true);
await store.partner.getData();
modalLoader.setLoading(false);
},
pageSize: store.partner.pageSize,
total: store.partner.total_data,
current: store.partner.page,
style: { marginBottom: "1rem", marginRight: "1rem" },
current: store.partner.page + 1,
style: {marginBottom: "1rem", marginRight: "1rem"},
}}
dataSource={store.partner.data}
style={{ padding: 0 }}

View File

@@ -281,15 +281,15 @@ export const ProductComponent = observer((props) => {
pagination={{
onChange: async (page) => {
store.product.pageSize = page.pageSize;
store.product.page = page.current;
store.product.page = page.current - 1;
modalLoader.setLoading(true);
await store.product.getData();
modalLoader.setLoading(false);
},
pageSize: store.product.pageSize,
total: store.product.total_data,
current: store.product.page,
style: { marginBottom: "1rem", marginRight: "1rem" },
current: store.product.page + 1,
style: {marginBottom: "1rem", marginRight: "1rem"},
}}
dataSource={store.product.data}
style={{ padding: 0 }}

View File

@@ -125,15 +125,15 @@ export const SubcategoryComponent = observer((props) => {
pagination={{
onChange: async (page) => {
store.subcategory.pageSize = page.pageSize;
store.subcategory.page = page.current;
store.subcategory.page = page.current - 1;
modalLoader.setLoading(true);
await store.subcategory.getData();
modalLoader.setLoading(false);
},
pageSize: store.subcategory.pageSize,
total: store.subcategory.total_data,
current: store.subcategory.page,
style: { marginBottom: "1rem", marginRight: "1rem" },
current: store.subcategory.page + 1,
style: {marginBottom: "1rem", marginRight: "1rem"},
}}
dataSource={store.subcategory.data}
style={{ padding: 0 }}

View File

@@ -1,23 +1,12 @@
import React, { useContext, useState } from "react";
import {
Button,
Form,
Input,
message,
Modal,
Space,
Table,
Tag,
List,
Divider,
} from "antd";
import { observer } from "mobx-react-lite";
import { ExclamationCircleOutlined } from "@ant-design/icons";
import { useHistory } from "react-router-dom";
import { useStore } from "../utils/useStore";
import { LINKS } from "../routes/app";
import { TopupsaldoModal } from "./TopupsaldoModal";
import { ModalLoaderContext } from "../utils/modal";
import React, {useContext, useState} from "react";
import {Button, Divider, Form, Input, List, message, Modal, Space, Table, Tag,} from "antd";
import {observer} from "mobx-react-lite";
import {ExclamationCircleOutlined} from "@ant-design/icons";
import {useHistory} from "react-router-dom";
import {useStore} from "../utils/useStore";
import {LINKS} from "../routes/app";
import {TopupsaldoModal} from "./TopupsaldoModal";
import {ModalLoaderContext} from "../utils/modal";
export const SupplierComponent = observer((props) => {
const store = useStore();
@@ -231,15 +220,15 @@ export const SupplierComponent = observer((props) => {
pagination={{
onChange: async (page) => {
store.supplier.pageSize = page.pageSize;
store.supplier.page = page.current;
store.supplier.page = page.current - 1;
modalLoader.setLoading(true);
await store.supplier.getData();
modalLoader.setLoading(false);
},
pageSize: store.supplier.pageSize,
total: store.supplier.total_data,
current: store.supplier.page,
style: { marginBottom: "1rem", marginRight: "1rem" },
current: store.supplier.page + 1,
style: {marginBottom: "1rem", marginRight: "1rem"},
}}
dataSource={store.supplier.data}
style={{ padding: 0 }}