Skip to content

Commit

Permalink
update medusa config to use new S3 file module
Browse files Browse the repository at this point in the history
  • Loading branch information
diboune committed Dec 12, 2024
1 parent 96db9d4 commit f37cbfe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 2 additions & 3 deletions backend/medusa-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ export default defineConfig({
},
},
{
resolve: "@medusajs/medusa/file",
resolve: "@medusajs/file",
key: Modules.FILE,
options: {
providers: [
{
resolve: "@medusajs/medusa/file-s3",
id: "s3",
options: {
authentication_method: "s3-iam-role",
file_url: process.env.S3_FILE_URL,
access_key_id: process.env.S3_ACCESS_KEY_ID,
secret_access_key: process.env.S3_SECRET_ACCESS_KEY,
region: process.env.S3_REGION,
bucket: process.env.S3_BUCKET,
endpoint: process.env.S3_ENDPOINT,
Expand Down
4 changes: 3 additions & 1 deletion storefront/components/global/header/cart/cart-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const CartContext = createContext<
lineItem: string,
newQuantity: number,
) => Promise<void>;
isUpdating: boolean;
setCartOpen: Dispatch<SetStateAction<boolean>>;
}
| undefined
Expand Down Expand Up @@ -120,7 +121,7 @@ export function CartProvider({
});
});
},
[setCartOpen, setOptimisticCart],
[setCartOpen, setOptimisticCart, cart],
);

useEffect(() => {
Expand Down Expand Up @@ -186,6 +187,7 @@ export function CartProvider({
cartOpen,
handleDeleteItem,
handleUpdateCartQuantity,
isUpdating: JSON.stringify(cart) !== JSON.stringify(optimisticCart),
setCartOpen,
}}
>
Expand Down
10 changes: 7 additions & 3 deletions storefront/components/global/header/cart/cart-footer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";

import {Link} from "@/components/shared/button";
import {Cta, Link} from "@/components/shared/button";
import Body from "@/components/shared/typography/body";
import {convertToLocale} from "@/utils/medusa/money";

import {useCart} from "./cart-context";

export default function CartFooter() {
const {cart} = useCart();
const {cart, isUpdating} = useCart();

const item_total = cart
? convertToLocale({
Expand Down Expand Up @@ -39,10 +39,14 @@ export default function CartFooter() {
</Body>
)}
</div>
{!cartIsEmpty && (
{!cartIsEmpty && !isUpdating ? (
<Link className="w-full" href="/checkout" size="lg" variant="primary">
Go to checkout
</Link>
) : (
<Cta className="w-full" disabled size="lg" variant="primary">
Go to checkout
</Cta>
)}
</div>
</>
Expand Down

0 comments on commit f37cbfe

Please sign in to comment.