Files
juwan-frontend/store/orders.ts
T
zetaloop cf0fea9926 refactor(orders): replace local state machine with minimal cache
Strip store/orders.ts to a thin local cache with setOrders and
updateOrder only. Remove all client-side state transition logic,
actor validation, chat sync, notification generation, and wallet
integration — these are now handled by the backend API.

Fix components/order-actions.tsx and stores that depended on
the removed order store methods (markDisputed, autoTimeout*).
2026-05-01 17:32:06 +08:00

18 lines
492 B
TypeScript

import type { Order } from "@/lib/types"
import { create } from "zustand"
interface OrderState {
orders: Order[]
setOrders: (orders: Order[]) => void
updateOrder: (orderId: string, patch: Partial<Order>) => void
}
export const useOrderStore = create<OrderState>((set) => ({
orders: [],
setOrders: (orders) => set({ orders }),
updateOrder: (orderId, patch) =>
set((state) => ({
orders: state.orders.map((o) => (o.id === orderId ? { ...o, ...patch } : o)),
})),
}))