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:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user