From 62f25b624b420fd1296df5355dafeb69d2906d08 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Thu, 1 Jan 2026 17:25:19 +0700 Subject: [PATCH] feat: auto-login after checkout via page reload Changed Checkout page order success handling: - Before: SPA navigate() to thank-you page (cookies not refreshed) - After: window.location.href + reload (cookies refreshed) This ensures guests who are auto-registered during checkout get their auth cookies properly set after order placement. --- customer-spa/src/pages/Checkout/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/customer-spa/src/pages/Checkout/index.tsx b/customer-spa/src/pages/Checkout/index.tsx index 007e031..f621483 100644 --- a/customer-spa/src/pages/Checkout/index.tsx +++ b/customer-spa/src/pages/Checkout/index.tsx @@ -241,7 +241,12 @@ export default function Checkout() { useCartStore.getState().clearCart(); toast.success('Order placed successfully!'); - navigate(`/order-received/${data.order_id}?key=${data.order_key}`); + + // Use full page reload instead of SPA routing + // This ensures auto-registered users get their auth cookies properly set + const thankYouUrl = `${window.location.origin}/store/#/order-received/${data.order_id}?key=${data.order_key}`; + window.location.href = thankYouUrl; + window.location.reload(); } else { throw new Error(data.error || 'Failed to create order'); }