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.
This commit is contained in:
Dwindi Ramadhana
2026-01-01 17:25:19 +07:00
parent 10b3c0e47f
commit 62f25b624b

View File

@@ -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');
}