Data Membership
This commit is contained in:
parent
56252bbd53
commit
ac948f3dd5
|
@ -16,7 +16,6 @@ export const Membership = observer(() => {
|
|||
const [confirmLoading, setConfirmLoading] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
try {
|
||||
setIsLoading(true)
|
||||
|
@ -26,6 +25,8 @@ export const Membership = observer(() => {
|
|||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
init()
|
||||
|
||||
|
@ -34,25 +35,25 @@ export const Membership = observer(() => {
|
|||
const columns = [
|
||||
{
|
||||
title: "Name",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
dataIndex: "username",
|
||||
key: "username",
|
||||
},
|
||||
{
|
||||
title: "Username",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
dataIndex: "username",
|
||||
key: "username",
|
||||
},
|
||||
{
|
||||
title: "Status",
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
render: (text, record) => (
|
||||
<>
|
||||
<Tag color="#E3E8EE" style={{color: "#4F566B"}}>
|
||||
Inactive
|
||||
<Tag
|
||||
color={record?.isActive === true ? "processing" : "#E3E8EE"}
|
||||
style={{color: "#4F566B"}}
|
||||
>
|
||||
{record?.status}
|
||||
</Tag>
|
||||
<Tag color="processing">Active</Tag>
|
||||
</>
|
||||
)
|
||||
},
|
||||
{
|
||||
|
@ -163,21 +164,21 @@ export const Membership = observer(() => {
|
|||
hasEmpty
|
||||
size={"small"}
|
||||
columns={columns}
|
||||
dataSource={store.membership.data}
|
||||
dataSource={store.membership.data[0]}
|
||||
bordered
|
||||
pagination={{
|
||||
total: store.membership.total_data,
|
||||
current: store.membership.page,
|
||||
pageSize: store.membership.pageSize,
|
||||
simple: true
|
||||
}}
|
||||
onChange={(page) => {
|
||||
store.membership.pageSize = page.pageSize;
|
||||
store.membership.page = page.current;
|
||||
store.membership.getData();
|
||||
}}
|
||||
current={store.membership.page}
|
||||
loading={store.membership.pageSize}
|
||||
// pagination={{
|
||||
// total: store.membership.total_data,
|
||||
// current: store.membership.page,
|
||||
// pageSize: store.membership.pageSize,
|
||||
// simple: true
|
||||
// }}
|
||||
// onChange={(page) => {
|
||||
// store.membership.pageSize = page.pageSize;
|
||||
// store.membership.page = page.current;
|
||||
// store.membership.getData();
|
||||
// }}
|
||||
// current={store.membership.page}
|
||||
// loading={store.membership.pageSize}
|
||||
/>)}
|
||||
|
||||
{store.ui.mediaQuery.isMobile && (
|
||||
|
|
|
@ -2,7 +2,7 @@ import {action, makeAutoObservable} from "mobx";
|
|||
import {http} from "../utils/http";
|
||||
|
||||
export class Membership {
|
||||
page = 1;
|
||||
page = 0;
|
||||
pageSize = 10
|
||||
data = [];
|
||||
total_data = 0
|
||||
|
@ -14,7 +14,9 @@ export class Membership {
|
|||
|
||||
@action
|
||||
async getData() {
|
||||
const response = await http.get(`/user?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
const response = await http.get(`/users/find-by-supperior?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
// console.log(response, 'Data user')
|
||||
// console.log(JSON.stringify(response.body.data), 'Data')
|
||||
this.data = response.body.data ?? []
|
||||
this.total_data = response.body.total_data ?? 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user