Fix: ensureChat ответ {id,user_a,user_b}, не {chat_id}
This commit is contained in:
parent
34d4292538
commit
53bf382b84
@ -307,8 +307,11 @@ const UserProfileView = {
|
|||||||
msgBtn.textContent = '⏳ Открываем…';
|
msgBtn.textContent = '⏳ Открываем…';
|
||||||
try {
|
try {
|
||||||
const r = await API.ChatApi.ensureChat(this.userId);
|
const r = await API.ChatApi.ensureChat(this.userId);
|
||||||
const cid = r.chat_id || r.chat?.id;
|
const cid = r.chat_id || r.chat?.id || r.id;
|
||||||
if (!cid) throw new Error('chat not created');
|
if (!cid) {
|
||||||
|
console.error('[UserProfile] no chat id in response', r);
|
||||||
|
throw new Error('chat not created');
|
||||||
|
}
|
||||||
App.openChat(cid, this.userId, u.name);
|
App.openChat(cid, this.userId, u.name);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
msgBtn.className = 'btn-b err';
|
msgBtn.className = 'btn-b err';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user