account view endpoint added
This commit was merged in pull request #9.
This commit is contained in:
@@ -5,7 +5,7 @@ import queryKeys from '../../services/queryKeys'
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import { getProducts } from '../../services/siteServices'
|
||||
import { getCustomTemplate } from '../../services/siteServices'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
|
||||
|
||||
export default function CustomTemplates() {
|
||||
@@ -32,18 +32,18 @@ export default function CustomTemplates() {
|
||||
}
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.products, page, willFilter],
|
||||
queryKey: [...queryKeys.custom_template, page, willFilter],
|
||||
queryFn: () => {
|
||||
const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
page,
|
||||
...filterData
|
||||
}
|
||||
return getProducts(reqData)
|
||||
return getCustomTemplate(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const productsData = data?.data?.products // PRODUCTS LIST
|
||||
const customTemData = data?.data?.products // CUSTOM TEMPLATE LIST
|
||||
const pagination = data?.data?.pagination
|
||||
// console.log('DATA', data?.data)
|
||||
|
||||
@@ -72,20 +72,20 @@ export default function CustomTemplates() {
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={productsData} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
<TablePaginatedWrapper data={customTemData} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Added
|
||||
ID
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Name
|
||||
Custom ID
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Product ID
|
||||
Provision Name
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Status
|
||||
|
||||
@@ -5,7 +5,7 @@ import queryKeys from '../../services/queryKeys'
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import { getProducts } from '../../services/siteServices'
|
||||
import { getProductsTemplate } from '../../services/siteServices'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
|
||||
|
||||
export default function ProductTemplates() {
|
||||
@@ -32,18 +32,18 @@ export default function ProductTemplates() {
|
||||
}
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.products, page, willFilter],
|
||||
queryKey: [...queryKeys.products_template, page, willFilter],
|
||||
queryFn: () => {
|
||||
const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
page,
|
||||
...filterData
|
||||
}
|
||||
return getProducts(reqData)
|
||||
return getProductsTemplate(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const productsData = data?.data?.products // PRODUCTS LIST
|
||||
const productsTemData = data?.data?.products // PRODUCTS TEMPLATE LIST
|
||||
const pagination = data?.data?.pagination
|
||||
// console.log('DATA', data?.data)
|
||||
|
||||
@@ -72,20 +72,20 @@ export default function ProductTemplates() {
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={productsData} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
<TablePaginatedWrapper data={productsTemData} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Added
|
||||
Product ID
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Name
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Product ID
|
||||
Provision Name
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Status
|
||||
|
||||
Reference in New Issue
Block a user