diff --git a/packages/api/src/EmbeddedChatApi.ts b/packages/api/src/EmbeddedChatApi.ts index 72e25a046..59a2f7e98 100644 --- a/packages/api/src/EmbeddedChatApi.ts +++ b/packages/api/src/EmbeddedChatApi.ts @@ -495,34 +495,26 @@ export default class EmbeddedChatApi { try { const { userId, authToken } = (await this.auth.getCurrentUser()) || {}; const response = await fetch( - `${this.host}/api/v1/method.call/rooms%3Aget`, + `${this.host}/api/v1/rooms.info?roomId=${this.rid}`, { - body: JSON.stringify({ - message: JSON.stringify({ - msg: "method", - id: null, - method: "rooms/get", - params: [], - }), - }), headers: { "Content-Type": "application/json", "X-Auth-Token": authToken, "X-User-Id": userId, }, - method: "POST", + method: "GET", } ); const result = await response.json(); - if (result.success && result.message) { - const parsedMessage = JSON.parse(result.message); - return parsedMessage; + if (result.success && result.room) { + return { result: [result.room] }; } - return null; + return { result: [] }; } catch (err) { console.error(err); + return { result: [] }; } } diff --git a/packages/react/src/views/ChatHeader/ChatHeader.js b/packages/react/src/views/ChatHeader/ChatHeader.js index 0986104ae..18399ae17 100644 --- a/packages/react/src/views/ChatHeader/ChatHeader.js +++ b/packages/react/src/views/ChatHeader/ChatHeader.js @@ -199,7 +199,7 @@ const ChatHeader = ({ setIsChannelArchived(true); const roomInfo = await RCInstance.getRoomInfo(); const roomData = roomInfo.result[roomInfo.result.length - 1]; - setChannelInfo(roomData); + setChannelInfo(roomData || {}); } else if ('errorType' in res && res.errorType === 'Not Allowed') { dispatchToastMessage({ type: 'error',