diff --git a/src/components/data-grid/DataGridLoader.tsx b/src/components/data-grid/DataGridLoader.tsx
index 03666a5..4802bb6 100644
--- a/src/components/data-grid/DataGridLoader.tsx
+++ b/src/components/data-grid/DataGridLoader.tsx
@@ -4,9 +4,9 @@ import { RefreshCw } from 'lucide-react';
export const DataGridLoader = () => {
return (
-
-
-
+
+
+
Refreshing data...
diff --git a/src/layouts/demo2/header/HeaderTopbar.tsx b/src/layouts/demo2/header/HeaderTopbar.tsx
index 30e26f1..4786e5c 100644
--- a/src/layouts/demo2/header/HeaderTopbar.tsx
+++ b/src/layouts/demo2/header/HeaderTopbar.tsx
@@ -32,7 +32,7 @@ const HeaderTopbar = () => {
- {getAuth()?.user.username}
+ {getAuth()?.user.name}
as {getAuth()?.role_name}
diff --git a/src/pages/members/kyc/Kyc.tsx b/src/pages/members/kyc/Kyc.tsx
index bf04b12..0d226a4 100644
--- a/src/pages/members/kyc/Kyc.tsx
+++ b/src/pages/members/kyc/Kyc.tsx
@@ -1,6 +1,7 @@
import {
Container,
DataGridInner,
+ DataGridLoader,
DataGridProvider,
TDataGridProps,
useDataGrid
@@ -36,11 +37,8 @@ const Kyc = () => {
};
const { getUser } = useAuthContext();
- useEffect(() => {
- fetchCustomers();
- }, [member]);
-
async function fetchCustomers() {
+ setIsReloading(true);
try {
let customers = await axios.get(`${BASE_URL}/customer/list`, {
params: {
@@ -73,7 +71,7 @@ const Kyc = () => {
toast.error(error.message);
console.log(error);
} finally {
- setLoading(false);
+ // setLoading(false);
setIsReloading(false);
}
}
@@ -101,7 +99,7 @@ const Kyc = () => {
};
const handleYes = async () => {
- setLoading(true);
+ // setLoading(true);
const userLogin: any = await getUser();
const updateData: any = member;
const customerId = member.id;
@@ -179,7 +177,7 @@ const Kyc = () => {
setDialogOpen(false);
setIsDialogOpen(false);
await fetchCustomers();
- setLoading(false);
+ // setLoading(false);
setIsReloading(false);
}
};
@@ -188,7 +186,11 @@ const Kyc = () => {
setIsDialogOpen(el);
}
- if (loading) return ;
+ useEffect(() => {
+ fetchCustomers();
+ }, [member]);
+
+ // if (isReloading) return ;
return (
<>
@@ -237,12 +239,13 @@ const Kyc = () => {
{/* */}
{isReloading && (
-
-
-
- Refreshing data...
-
-
+
+ //
+ //
+ //
+ // Refreshing data...
+ //
+ //
)}
{
};
const { getUser } = useAuthContext();
- useEffect(() => {
- setLoading(true);
- fetchCustomers();
- setLoading(false);
- }, []);
-
async function fetchCustomers(): Promise {
+ setIsReloading(true);
try {
let customers = await axios.get(`${BASE_URL}/customer/list`, {
params: {
@@ -62,6 +57,8 @@ const ManageMembers = () => {
return el;
});
setMembers(resMembers);
+ // setIsReloading(false);
+
let getProfession: any = await axios.get(`${BASE_URL_MASTER_DATA}/profession/list`, {
params: {
limit: 50,
@@ -73,20 +70,20 @@ const ManageMembers = () => {
});
setProfession(getProfession.data.data.list);
let getGroups = await axios.get(`${BASE_URL_CUSTOMER}/groups/list`, {
- params: {
- limit: 50,
- page: 1,
- with_deleted: false,
- order_field: 'name',
- order_direction: 'ASC'
- }
+ params: {
+ limit: 50,
+ page: 1,
+ with_deleted: false,
+ order_field: 'name',
+ order_direction: 'ASC'
+ }
});
setGroups(getGroups.data.data.list);
} catch (error: any) {
toast.error(error.message);
console.log(error);
} finally {
- setLoading(false);
+ // setLoading(false);
setIsReloading(false);
}
}
@@ -115,8 +112,9 @@ const ManageMembers = () => {
};
const handleYes = async () => {
+ setIsReloading(true);
try {
- setLoading(true);
+ // setLoading(true);
const userLogin: any = await getUser();
const updateData: any = member;
updateData.updated_by = userLogin.data ? userLogin.data.id : '';
@@ -193,14 +191,14 @@ const ManageMembers = () => {
}
} catch (error: any) {
if (error?.response?.data?.message) {
- toast.error(`${error?.response?.data?.error}.\n${error?.response?.data?.message}`)
- }
- else toast.error(error.message);
+ toast.error(`${error?.response?.data?.error}.\n${error?.response?.data?.message}`);
+ } else toast.error(error.message);
} finally {
setDialogOpen(false);
closeDialog();
await fetchCustomers();
- setLoading(false);
+ // setLoading(false);
+ setIsReloading(false);
}
};
@@ -208,7 +206,11 @@ const ManageMembers = () => {
setIsDialogOpen(el);
}
- if (loading) return ;
+ useEffect(() => {
+ fetchCustomers();
+ }, []);
+
+ // if (isReloading) return ;
return (
<>
@@ -255,14 +257,15 @@ const ManageMembers = () => {
{isReloading && (
-
-
-
-
- Refreshing data...
-
-
-
+
+ //
+ //
+ //
+ //
+ // Refreshing data...
+ //
+ //
+ //
)}
{
alt=""
/> */}
-
{auth?.user.name}
+
{auth?.user.username}
{auth?.user.email}