restore cart across devices

This commit is contained in:
2026-04-15 15:42:55 -06:00
parent 5ff5995bcf
commit f8f2a4b05e

View File

@@ -45,6 +45,12 @@ export function CartProvider({ children }) {
} }
}, []); }, []);
useEffect(() => {
if (user?.storeId && !localStorage.getItem(STORE_KEY)) {
setStoreId(user.storeId);
}
}, [user, setStoreId]);
const refreshCart = useCallback(async () => { const refreshCart = useCallback(async () => {
if (!token || !selectedStoreId) { if (!token || !selectedStoreId) {
setCart(null); setCart(null);