From 3b27975895a400d1059d58ef80705c7aec99fd49 Mon Sep 17 00:00:00 2001 From: Bala Lakshmi Narayanasami Date: Wed, 20 Jul 2022 20:17:28 +0530 Subject: [PATCH] Fixing test issue --- src/Chatbot/ChatbotClient.ts | 3 --- src/Explorer/Explorer.tsx | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Chatbot/ChatbotClient.ts b/src/Chatbot/ChatbotClient.ts index 77df06852..12f061dc2 100644 --- a/src/Chatbot/ChatbotClient.ts +++ b/src/Chatbot/ChatbotClient.ts @@ -5,9 +5,6 @@ import { getAuthorizationHeader } from "../Utils/AuthorizationUtils"; export class ChatbotClient { public async getConversationToken(): Promise<{ conversationId: string; token: string; expires_in: number }> { - if (!userContext.databaseAccount || !userContext.databaseAccount.id) { - throw new Error("Database account not set"); - } const url = `${configContext.JUNO_ENDPOINT}/api/chatbot/bot${userContext.databaseAccount.id}/conversationToken`; const authorizationHeader = getAuthorizationHeader(); const response = await window.fetch(url, { diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index b95430713..e170a8870 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -469,6 +469,10 @@ export default class Explorer { } private async generateConversationToken() { + if (userContext.databaseAccount === undefined || !userContext.databaseAccount.id === undefined) { + console.error("Database account not set"); + return; + } try { const tokenResponse = await this.chatbotClient.getConversationToken(); this.conversationToken(tokenResponse?.token);