balls
This commit is contained in:
38
app/dashboard/page.tsx
Normal file
38
app/dashboard/page.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import Dashboard from "@/components/kokonutui/dashboard";
|
||||
import Content from "@/components/kokonutui/content";
|
||||
import { fetchWithAuthorization } from "@/lib/server-utils"
|
||||
|
||||
// ✅ Corrected Vendor Type
|
||||
interface Vendor {
|
||||
_id: string;
|
||||
username: string;
|
||||
storeId: string;
|
||||
pgpKey: string;
|
||||
__v: number;
|
||||
}
|
||||
|
||||
interface User {
|
||||
vendor: Vendor;
|
||||
}
|
||||
|
||||
interface OrderStats {
|
||||
totalOrders: number;
|
||||
pendingOrders: number;
|
||||
completedOrders: number;
|
||||
cancelledOrders: number;
|
||||
}
|
||||
|
||||
export default async function DashboardPage() {
|
||||
const [userResponse, orderStats] = await Promise.all([
|
||||
fetchWithAuthorization<User>("/auth/me"),
|
||||
fetchWithAuthorization<OrderStats>("/orders/stats"),
|
||||
]);
|
||||
|
||||
const vendor = userResponse.vendor;
|
||||
|
||||
return (
|
||||
<Dashboard>
|
||||
<Content username={vendor.username} orderStats={orderStats} />
|
||||
</Dashboard>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user