refactor(errors): migrate decisions to {code,msg}
This commit is contained in:
@@ -150,7 +150,7 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin
|
||||
const file = event.target.files?.[0]
|
||||
if (!file) return
|
||||
const result = sendImageMessage(session.id, URL.createObjectURL(file))
|
||||
if (result && !result.ok) notifyInfo(result.message ?? "发送失败")
|
||||
if (!result.ok) notifyInfo(result.error.msg)
|
||||
event.target.value = ""
|
||||
}}
|
||||
/>
|
||||
@@ -162,8 +162,8 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin
|
||||
if (!text) return
|
||||
|
||||
const result = sendTextMessage(session.id, text)
|
||||
if (result && !result.ok) {
|
||||
notifyInfo(result.message ?? "发送失败")
|
||||
if (!result.ok) {
|
||||
notifyInfo(result.error.msg)
|
||||
return
|
||||
}
|
||||
setInput("")
|
||||
|
||||
@@ -112,7 +112,7 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
evidence: files,
|
||||
})
|
||||
if (!result.decision.ok) {
|
||||
notifyInfo(result.decision.message ?? "提交争议失败")
|
||||
notifyInfo(result.decision.error.msg)
|
||||
return
|
||||
}
|
||||
router.replace(`/dispute/${id}?submitted=1`)
|
||||
@@ -288,7 +288,7 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
evidence: responseFiles,
|
||||
})
|
||||
if (!decision.ok) {
|
||||
notifyInfo(decision.message ?? "提交回应失败")
|
||||
notifyInfo(decision.error.msg)
|
||||
}
|
||||
}}
|
||||
disabled={!responseReason.trim()}
|
||||
@@ -336,7 +336,7 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
reason: appealReason,
|
||||
})
|
||||
if (!decision.ok) {
|
||||
notifyInfo(decision.message ?? "提交申诉失败")
|
||||
notifyInfo(decision.error.msg)
|
||||
}
|
||||
}}
|
||||
disabled={!appealReason.trim()}
|
||||
|
||||
@@ -7,8 +7,8 @@ import { Input } from "@/components/ui/input"
|
||||
import { Label } from "@/components/ui/label"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { Textarea } from "@/components/ui/textarea"
|
||||
import type { Actor } from "@/lib/actor"
|
||||
import { getPlayerById, getServiceById } from "@/lib/api"
|
||||
import type { Actor } from "@/lib/policy/actor"
|
||||
import { notifySuccess } from "@/lib/toast"
|
||||
import { useRequireAuth } from "@/lib/use-require-auth"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
|
||||
@@ -154,7 +154,7 @@ export default function ReviewPage({ params }: { params: Promise<{ id: string }>
|
||||
return
|
||||
}
|
||||
|
||||
notifyInfo(decision.message ?? "评价提交失败")
|
||||
notifyInfo(decision.error.msg)
|
||||
}}
|
||||
>
|
||||
提交评价
|
||||
|
||||
Reference in New Issue
Block a user