Skip to content

Commit

Permalink
properly ppr /order
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanniser committed Oct 18, 2024
1 parent 0bbe37d commit ee73363
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/app/order/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import { LoginForm } from "@/components/login-form";
import { getCart } from "@/lib/cart";
import { X } from "lucide-react";
import type { CartItem } from "@/lib/cart";
import Image from "next/image";
import { db } from "@/db";
import { removeFromCart } from "@/lib/actions";
import { products } from "@/db/schema";
import { inArray } from "drizzle-orm";
import Link from "next/link";
import { Metadata } from "next";
import { Suspense } from "react";
import { CartItems, TotalCost } from "./dynamic";
Expand All @@ -17,25 +8,6 @@ export const metadata: Metadata = {
};

export default async function Page() {
const cart = await getCart();
const dbProducts = await db
.select()
.from(products)
.where(
inArray(
products.slug,
cart.map((item) => item.productSlug),
),
);

const totalCost = cart.reduce(
(acc, item) =>
acc +
item.quantity *
(Number(dbProducts.find((p) => p.slug === item.productSlug)?.price) ??
0),
0,
);
return (
<main className="min-h-screen p-4">
<div className="container mx-auto p-3">
Expand Down

0 comments on commit ee73363

Please sign in to comment.