update config

This commit is contained in:
NotII
2025-03-23 21:00:49 +00:00
parent b06e2ca0b1
commit dc51901c5c
2 changed files with 14 additions and 26 deletions

View File

@@ -129,6 +129,8 @@ export default function OrderTable() {
const queryParams = new URLSearchParams({
page: currentPage.toString(),
limit: itemsPerPage.toString(),
sortBy: sortConfig.column,
sortOrder: sortConfig.direction,
...(statusFilter !== "all" && { status: statusFilter }),
});
@@ -143,7 +145,7 @@ export default function OrderTable() {
} finally {
setLoading(false);
}
}, [currentPage, statusFilter, itemsPerPage]);
}, [currentPage, statusFilter, itemsPerPage, sortConfig]);
useEffect(() => {
fetchOrders();
@@ -169,27 +171,8 @@ export default function OrderTable() {
(order) => statusFilter === "all" || order.status === statusFilter
);
const sortedOrders = [...filteredOrders].sort((a, b) => {
const aValue = a[sortConfig.column];
const bValue = b[sortConfig.column];
if (typeof aValue === "string" && typeof bValue === "string") {
return sortConfig.direction === "asc"
? aValue.localeCompare(bValue)
: bValue.localeCompare(aValue);
}
if (typeof aValue === "number" && typeof bValue === "number") {
return sortConfig.direction === "asc" ? aValue - bValue : bValue - aValue;
}
return 0;
});
const paginatedOrders = sortedOrders.slice(
(currentPage - 1) * itemsPerPage,
currentPage * itemsPerPage
);
// Use the orders directly as they're already sorted by the server
const paginatedOrders = filteredOrders;
// Handlers
const handleSort = (column: SortableColumns) => {
@@ -197,6 +180,7 @@ export default function OrderTable() {
column,
direction: prev.column === column && prev.direction === "asc" ? "desc" : "asc"
}));
setCurrentPage(1); // Reset to first page when changing sort order
};
const toggleSelection = (orderId: string) => {
@@ -361,7 +345,7 @@ export default function OrderTable() {
<TableRow>
<TableHead className="w-12">
<Checkbox
checked={selectedOrders.size === orders.length && orders.length > 0}
checked={selectedOrders.size === paginatedOrders.length && paginatedOrders.length > 0}
onCheckedChange={toggleAll}
/>
</TableHead>
@@ -382,7 +366,7 @@ export default function OrderTable() {
</TableRow>
</TableHeader>
<TableBody>
{orders.map((order) => {
{paginatedOrders.map((order) => {
const StatusIcon = statusConfig[order.status as keyof typeof statusConfig]?.icon || XCircle;
return (

View File

@@ -9,14 +9,18 @@ const nextConfig = {
{
protocol: "https",
hostname: "telegram.org",
}
},
{
protocol: "https",
hostname: "internal-api.inboxi.ng",
},
],
},
async rewrites() {
return [
{
source: '/api/:path*',
destination: 'https://internal-api.inboxi.ng/api/:path*', // Replace with your external domain URL
destination: 'https://internal-api.inboxi.ng/api/:path*',
},
];
},