修复新用户首次进入联系客服页面发送信息报错问题

This commit is contained in:
yezian 2024-07-29 14:52:58 +08:00
parent e4ac08b77e
commit b73a6120b7
1 changed files with 4 additions and 2 deletions

View File

@ -210,6 +210,7 @@ export default function MessageDetail({ navigation, route }) {
return; return;
} }
setSessionId(createData.data.session_id); setSessionId(createData.data.session_id);
return createData.data.session_id;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@ -392,7 +393,8 @@ export default function MessageDetail({ navigation, route }) {
} }
//session //session
if (!sessionId) await createSession(); let _sessionId;
if (!sessionId) _sessionId = await createSession();
// //
setOffset((prev) => prev + 1); setOffset((prev) => prev + 1);
@ -414,7 +416,7 @@ export default function MessageDetail({ navigation, route }) {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({ body: JSON.stringify({
session_id: sessionId, session_id: sessionId ? sessionId : _sessionId,
predicate: 0, predicate: 0,
message: messages[0].text, message: messages[0].text,
...base, ...base,