Skip to content

Commit

Permalink
fix: nc loading issue for eu env (#4904)
Browse files Browse the repository at this point in the history
  • Loading branch information
BiswaViraj committed Dec 4, 2023
1 parent 609d6b8 commit 914cc47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import { useMantineColorScheme } from '@mantine/core';
import { IUserEntity, IMessage, MessageActionStatusEnum, ButtonTypeEnum } from '@novu/shared';
import { NotificationBell, NovuProvider, PopoverNotificationCenter, useUpdateAction } from '@novu/notification-center';

import { API_ROOT, APP_ID, WS_URL } from '../../../config';
import { API_ROOT, APP_ID, WS_URL, IS_EU_ENV } from '../../../config';
import { useEnvController } from '../../../hooks';

const BACKEND_URL = IS_EU_ENV ? 'https://api.novu.co' : API_ROOT;
const SOCKET_URL = IS_EU_ENV ? 'https://ws.novu.co' : WS_URL;

export function NotificationCenterWidget({ user }: { user: IUserEntity | undefined }) {
const { environment } = useEnvController();

return (
<>
<NovuProvider
backendUrl={API_ROOT}
socketUrl={WS_URL}
backendUrl={BACKEND_URL}
socketUrl={SOCKET_URL}
subscriberId={user?._id as string}
applicationIdentifier={APP_ID || (environment?.identifier as string)}
>
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ export const IS_TEMPLATE_STORE_ENABLED = isCypress
export const IS_MULTI_TENANCY_ENABLED = isCypress
? window._env_.IS_MULTI_TENANCY_ENABLED || process.env.IS_MULTI_TENANCY_ENABLED || 'true'
: window._env_.IS_MULTI_TENANCY_ENABLED || process.env.IS_MULTI_TENANCY_ENABLED || 'false';

export const IS_EU_ENV = (ENV === 'production' || ENV === 'prod') && API_ROOT.includes('eu.api.novu.co');

0 comments on commit 914cc47

Please sign in to comment.