cf0fea9926
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*).
18 lines
492 B
TypeScript
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)),
|
|
})),
|
|
}))
|