diff --git a/src/pages/account/manage-account/ManageAccount.tsx b/src/pages/account/manage-account/ManageAccount.tsx index b2a5f31..7663276 100644 --- a/src/pages/account/manage-account/ManageAccount.tsx +++ b/src/pages/account/manage-account/ManageAccount.tsx @@ -34,47 +34,54 @@ const ManageAccount = () => { const { GetData } = useCallApi(); // console.log(accounts); - useEffect(() => { - const fetchAccount = async () => { - try { - const response = await fetch(`${API_URL}/user/list`); - const data: Account[] = await response.json(); - setAccounts(data); - } catch (error) { - console.error('Error fetching data', error); - } - }; + // useEffect(() => { + // const fetchAccount = async () => { + // try { + // const response = await axios.get(`${API_URL}/user/list`); + // console.log(response); + // const data: Account[] = response.data; + // setAccounts(data); + // } catch (error) { + // console.error('Error fetching data', error); + // } + // }; - fetchAccount(); - }, []); + // fetchAccount(); + // }, []); - // const fetchAccount = async (page: number, limit: number, sorting: any, filter: any) => { - // try { - // const response = await GetData(`${API_URL}/user/list`, { - // limit: limit, - // page: page + 1, - // with_deleted: true, - // order_field: sorting[0].id, - // order_direction: sorting[0].desc == false ? 'ASC' : 'DESC', - // filter: JSON.stringify(filter) - // }); + const fetchAccount = async (page: number, limit: number, sorting: any, filter: any) => { + try { + const response = await GetData(`${API_URL}/user/list`, { + limit: limit, + page: page + 1, + with_deleted: true, + order_field: sorting[0].id, + order_direction: sorting[0].desc == false ? 'ASC' : 'DESC', + filter: JSON.stringify(filter) + }); - // setAccounts(response?.data.list); + console.log(response?.data.list); + setAccounts(response?.data.list); - // return { - // data: response?.data.list, - // totalCount: response?.data.total_count - // }; - // } catch (error) { - // console.log(error); - // } - // }; + return { + data: response?.data.list, + totalCount: response?.data.total_count + }; + } catch (error) { + console.log(error); + } + }; return (

Manage Account

- + console.log('update')} + onDelete={() => console.log('delete')} + />
);