refactor(mock): remove lib/mock fixtures and empty stores
This commit is contained in:
+1
-37
@@ -3,7 +3,6 @@ import { DISPUTE_TO_RESOLVED_MS, DISPUTE_TO_REVIEWING_MS } from "@/lib/config/de
|
||||
import { allow, deny } from "@/lib/decision"
|
||||
import type { ApiDecision } from "@/lib/errors"
|
||||
import { generateId } from "@/lib/id"
|
||||
import { mockDisputes } from "@/lib/mock"
|
||||
import type { Dispute } from "@/lib/types"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
import { useNotificationStore } from "@/store/notifications"
|
||||
@@ -87,41 +86,6 @@ function resolveParticipantActor(orderId: string, userId: string): Actor | null
|
||||
return null
|
||||
}
|
||||
|
||||
function asRecord(dispute: Dispute): DisputeRecord {
|
||||
const timeline: DisputeTimelineItem[] = [
|
||||
{
|
||||
id: generateId("timeline"),
|
||||
type: "created",
|
||||
content: `${dispute.initiatorName} 提交争议`,
|
||||
createdAt: dispute.createdAt,
|
||||
},
|
||||
]
|
||||
|
||||
if (dispute.status === "reviewing") {
|
||||
timeline.push({
|
||||
id: generateId("timeline"),
|
||||
type: "reviewing",
|
||||
content: "平台已受理并进入审核",
|
||||
createdAt: dispute.createdAt,
|
||||
})
|
||||
}
|
||||
|
||||
if (dispute.status === "resolved") {
|
||||
timeline.push({
|
||||
id: generateId("timeline"),
|
||||
type: "resolved",
|
||||
content: "平台已给出仲裁结果",
|
||||
createdAt: dispute.createdAt,
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
...dispute,
|
||||
respondentEvidence: [],
|
||||
timeline,
|
||||
}
|
||||
}
|
||||
|
||||
function notifyDispute(orderId: string, title: string, content: string) {
|
||||
if (!useAuthStore.getState().notificationPrefs.order) {
|
||||
return
|
||||
@@ -200,7 +164,7 @@ export const useDisputeStore = create<DisputeState>((set, get) => {
|
||||
}
|
||||
|
||||
return {
|
||||
disputes: mockDisputes.map(asRecord),
|
||||
disputes: [],
|
||||
getDisputeByOrderId: (orderId) => get().disputes.find((dispute) => dispute.orderId === orderId),
|
||||
submitDispute: (input) => {
|
||||
const order = useOrderStore.getState().orders.find((item) => item.id === input.orderId)
|
||||
|
||||
Reference in New Issue
Block a user