From 6927d53c59cc4e9da56655cc0b99e1247347a7c9 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 6 Oct 2025 20:01:48 +0100 Subject: [PATCH] fixed endpoint --- src/components/country/CountrySettings.jsx | 220 +++++++-------------- 1 file changed, 66 insertions(+), 154 deletions(-) diff --git a/src/components/country/CountrySettings.jsx b/src/components/country/CountrySettings.jsx index 3f4578b..63191da 100644 --- a/src/components/country/CountrySettings.jsx +++ b/src/components/country/CountrySettings.jsx @@ -3,36 +3,13 @@ import { useQuery } from '@tanstack/react-query' import queryKeys from '../../services/queryKeys' import BreadcrumbCom from "../breadcrumb/BreadcrumbCom"; import { getCountry } from "../../services/siteServices"; -import TablePaginatedWrapper from "../tableWrapper/TablePaginatedWrapper"; +import TableWrapper from "../tableWrapper/TableWrapper"; export default function CountrySettings(){ - const [page, setPage] = useState(1) - const [filter, setFilter] = useState({type: '', id: ''}) - const [willFilter, setWillFilter] = useState(false) - - const handleFilter = ({target:{name, value}}) => { - setFilter(prev => ({...prev, [name]:value})) - } - - const handleFilterByParams = () => { - if(filter.type && !filter.id){ - return - }else if(!filter.type){ - setPage(1) - setWillFilter(prev => !prev) - setFilter({type: '', id: ''}) - }else{ - setPage(1) - setWillFilter(prev => !prev) - } - } - const {data, isFetching, isError, error} = useQuery({ - // queryKey: [...queryKeys.country_list, page, willFilter], queryKey: queryKeys.country_list, queryFn: () => { - // const filterData = filter?.type ? {[filter?.type]: filter.id} : {} const reqData = { // page, // ...filterData @@ -41,9 +18,8 @@ export default function CountrySettings(){ }, staleTime: 0 //0 mins }) - const countryData = data?.data?.templates // PRODUCTS TEMPLATE LIST - const pagination = data?.data?.pagination - console.log('DATA', data?.data) + const countryData = data?.data?.country_data // COUNTRY LIST + return (
@@ -52,135 +28,71 @@ export default function CountrySettings(){
<> - {/* - - - - - - - - - - - - - - - - - - - - - - -
- Code - - Country - - Status - - Signup -
-
-
-
US
-
-
-
-
-
United States
-
-
-
-
[chkbox]
-
-
-
-
[chkbox]
-
-
-
-
-
NG
-
-
-
-
-
Nigeria
-
-
-
-
[chkbox]
-
-
-
-
[chkbox]
-
-
*/} - - {({ data }) => ( - <> - - - - - - - - - - - {(data && data.length > 0) ? data?.map((item, index) => ( - - + + + + + )) + : + + + + } + +
- Code - - Country - - Status - - Signup -
-
+ {isFetching ? +

Loading...

+ : isError ? +

{error.message}

+ : + + {({ data }) => ( + <> + + + + + + + + + + + {(data && data.length > 0) ? data?.map((item, index) => ( + + - - - - - )) - : - - - - } - -
+ Code + + Country + + Status + + Signup +
-
US
+
{item?.code}
- -
-
-
United States
-
-
-
-
[chkbox]
-
-
-
-
[chkbox]
-
-
-
- No Record Found -
-
- - )} - +
+
+
{item?.description}
+
+
+
+
{item?.status}
+
+
+
+
{item?.signup}
+
+
+
+ No Record Found +
+
+ + )} + + }
-- 2.34.1