feat(chat): migrate chat to backend API
This commit is contained in:
@@ -12,7 +12,6 @@ import type { ApiDecision } from "@/lib/errors"
|
||||
import { notifyInfo, notifySuccess } from "@/lib/toast"
|
||||
import type { Order, OrderStatus } from "@/lib/types"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
import { useChatStore } from "@/store/chat"
|
||||
import { useOrderStore } from "@/store/orders"
|
||||
import { useShopStore } from "@/store/shops"
|
||||
import {
|
||||
@@ -51,15 +50,12 @@ export default function OrderActions({
|
||||
const currentUserId = useAuthStore((state) => state.user?.id)
|
||||
const storeOrder = useOrderStore((state) => state.orders.find((item) => item.id === orderId))
|
||||
const order = orderProp ?? storeOrder
|
||||
const sessions = useChatStore((state) => state.sessions)
|
||||
const dispatchMode = useShopStore((state) => {
|
||||
if (!order?.shopId) return "manual"
|
||||
const shop = state.shops.find((item) => item.id === order.shopId)
|
||||
return shop?.dispatchMode ?? "manual"
|
||||
})
|
||||
const resolvedChatSessionId =
|
||||
chatSessionId ??
|
||||
sessions.find((session) => session.type === "order" && session.orderId === orderId)?.id
|
||||
const resolvedChatSessionId = chatSessionId
|
||||
|
||||
const status = order?.status ?? initialStatus
|
||||
const isConsumer = order?.consumerId === currentUserId
|
||||
|
||||
Reference in New Issue
Block a user