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("")
|
||||
|
||||
Reference in New Issue
Block a user