diff --git a/frontend/pages/api/bot/getBot.ts b/frontend/pages/api/bot/getBot.ts
index 6621dbe2f..145b50891 100644
--- a/frontend/pages/api/bot/getBot.ts
+++ b/frontend/pages/api/bot/getBot.ts
@@ -21,7 +21,7 @@ const getBot = async ({ workspaceId }: Props) => {
}
).then(async (res) => {
if (res && res.status == 200) {
- return await res.json();
+ return (await res.json()).bot;
} else {
console.log("Failed to get bot for project");
}
diff --git a/frontend/pages/integrations/[id].js b/frontend/pages/integrations/[id].js
index 6ffccac90..0aa5df5e0 100644
--- a/frontend/pages/integrations/[id].js
+++ b/frontend/pages/integrations/[id].js
@@ -23,8 +23,8 @@ const {
const crypto = require("crypto");
export default function Integrations() {
- const [projectIntegrations, setProjectIntegrations] = useState([]);
- const [authorizations, setAuthorizations] = useState();
+ const [integrationAuths, setIntegrationAuths] = useState([]);
+ const [integrations, setIntegrations] = useState([]);
const [bot, setBot] = useState(null);
const [isActivateBotOpen, setIsActivateBotOpen] = useState(false);
const [selectedIntegrationOption, setSelectedIntegrationOption] = useState(null);
@@ -33,23 +33,20 @@ export default function Integrations() {
useEffect(async () => {
try {
- // get integrations authorized for project
- let projectAuthorizations = await getWorkspaceAuthorizations({
+ // get project integration authorizations
+ setIntegrationAuths(await getWorkspaceAuthorizations({
workspaceId: router.query.id,
- });
- setAuthorizations(projectAuthorizations);
+ }));
- // get active/inactive (cloud) integrations for project
- const projectIntegrations = await getWorkspaceIntegrations({
+ // get project integrations
+ setIntegrations(await getWorkspaceIntegrations({
workspaceId: router.query.id,
- });
- setProjectIntegrations(projectIntegrations);
+ }));
- // get bot for project
- const bot = await getBot({
+ // get project bot
+ setBot(await getBot({
workspaceId: router.query.id
- });
- setBot(bot.bot);
+ }));
} catch (err) {
console.log(err);
@@ -170,18 +167,18 @@ export default function Integrations() {
handleBotActivate={handleBotActivate}
handleIntegrationOption={handleIntegrationOption}
/>
- {projectIntegrations.length > 0 && (
+ {integrations.length > 0 && ( // shouldn't need to check for length
)}