From 9f55d904a4709c49343f31a1e0794c9ddcbe4672 Mon Sep 17 00:00:00 2001 From: Deepak Bhagat Date: Sun, 25 Jan 2026 02:45:02 +0530 Subject: [PATCH] fix: replace deprecated getUserRoles method call with REST API --- packages/api/src/EmbeddedChatApi.ts | 32 +++++------------------------ 1 file changed, 5 insertions(+), 27 deletions(-) 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: [] }; } }