Skip to content

Commit

Permalink
hotfix: Use hook for snootyenv (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
casthewiz committed Sep 25, 2023
1 parent 4f70e5f commit eb2320b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/ChatbotUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import styled from '@emotion/styled';
import { palette } from '@leafygreen-ui/palette';
import { theme } from '../theme/docsTheme';
import 'react-loading-skeleton/dist/skeleton.css';

const CHATBOT_SERVER_BASE_URL =
process.env.SNOOTY_ENV === 'dotcomprd'
? 'https://knowledge.mongodb.com/api/v1'
: 'https://knowledge.staging.corp.mongodb.com/api/v1';
import { useSiteMetadata } from '../hooks/use-site-metadata';

const SKELETON_BORDER_RADIUS = '12px';

Expand Down Expand Up @@ -75,6 +71,13 @@ const StyledChatBotUiContainer = styled.div`
const LazyChatbot = lazy(() => import('mongodb-chatbot-ui'));

const ChatbotUi = ({ template }) => {
const { snootyEnv } = useSiteMetadata();

const CHATBOT_SERVER_BASE_URL =
snootyEnv === 'production' || snootyEnv === 'dotcomprd'
? 'https://knowledge.mongodb.com/api/v1'
: 'https://knowledge.staging.corp.mongodb.com/api/v1';

return (
<StyledChatBotUiContainer data-testid="chatbot-ui" template={template}>
{/* We wrapped this in a Suspense. We can use this opportunity to render a loading state if we decided we want that */}
Expand Down

0 comments on commit eb2320b

Please sign in to comment.