diff --git a/packages/api/src/EmbeddedChatApi.ts b/packages/api/src/EmbeddedChatApi.ts index 72e25a046..535ee2bc5 100644 --- a/packages/api/src/EmbeddedChatApi.ts +++ b/packages/api/src/EmbeddedChatApi.ts @@ -697,36 +697,14 @@ export default class EmbeddedChatApi { async getUserRoles() { try { - const { userId, authToken } = (await this.auth.getCurrentUser()) || {}; - const response = await fetch( - `${this.host}/api/v1/method.call/getUserRoles`, - { - body: JSON.stringify({ - message: JSON.stringify({ - msg: "method", - id: null, - method: "getUserRoles", - params: [], - }), - }), - headers: { - "Content-Type": "application/json", - "X-Auth-Token": authToken, - "X-User-Id": userId, - }, - method: "POST", - } - ); - - const result = await response.json(); - - if (result.success && result.message) { - const parsedMessage = JSON.parse(result.message); - return parsedMessage; + const response = await this.getUsersInRole("admin"); + if (response && response.success) { + return { result: response.users }; } - return null; + return { result: [] }; } catch (err) { console.error(err); + return { result: [] }; } }