diff --git a/packages/manager/apps/hub-react/src/data/api/notifications.ts b/packages/manager/apps/hub-react/src/data/api/notifications.ts index 6b5d45b1570f..80e13829078a 100644 --- a/packages/manager/apps/hub-react/src/data/api/notifications.ts +++ b/packages/manager/apps/hub-react/src/data/api/notifications.ts @@ -1,4 +1,5 @@ import { aapi } from '@ovh-ux/manager-core-api'; +import i18next from 'i18next'; import { ApiEnvelope } from '@/types/apiEnvelope.type'; import { Notification, NotificationsList } from '@/types/notifications.type'; @@ -7,6 +8,11 @@ const hubNotificationStatuses = ['warning', 'error']; export const getNotifications: () => Promise = async () => { const { data } = await aapi.get>( `/hub/notifications`, + { + headers: { + 'Content-Language': i18next.language.replace('-', '_'), + }, + }, ); return ( data.data?.notifications.data || [] diff --git a/packages/manager/apps/hub-react/src/data/hooks/notifications/useNotifications.spec.tsx b/packages/manager/apps/hub-react/src/data/hooks/notifications/useNotifications.spec.tsx index 82a41d227aaa..3f399c431635 100644 --- a/packages/manager/apps/hub-react/src/data/hooks/notifications/useNotifications.spec.tsx +++ b/packages/manager/apps/hub-react/src/data/hooks/notifications/useNotifications.spec.tsx @@ -12,6 +12,11 @@ const queryClient = new QueryClient(); const wrapper = ({ children }: PropsWithChildren) => ( {children} ); +vi.mock('i18next', () => ({ + default: { + language: 'fr_FR', + }, +})); describe('useFetchHubNotifications', () => { it('should return notifications after extracting them from api envelope', async () => { diff --git a/packages/manager/apps/hub-react/src/pages/layout.test.tsx b/packages/manager/apps/hub-react/src/pages/layout.test.tsx deleted file mode 100644 index 385521f1738b..000000000000 --- a/packages/manager/apps/hub-react/src/pages/layout.test.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; -import { describe, expect, it, vi } from 'vitest'; -import { render } from '@testing-library/react'; -import '@testing-library/jest-dom'; -import * as reactShellClientModule from '@ovh-ux/manager-react-shell-client'; -import { - ShellContext, - ShellContextType, -} from '@ovh-ux/manager-react-shell-client'; -import Layout from '@/pages/layout'; - -const shellContext = { - environment: { - getUser: vi.fn(), - }, - shell: { - ux: { - hidePreloader: vi.fn(), - }, - }, -}; - -const renderComponent = () => - render( - - - , - ); - -const mockPath = '/foo'; - -vi.mock('react-router-dom', () => ({ - useLocation: () => ({ - pathname: mockPath, - }), -})); - -vi.mock('@ovh-ux/manager-react-shell-client', async (importOriginal) => { - const original: typeof reactShellClientModule = await importOriginal(); - return { - ...original, - useOvhTracking: vi.fn(() => ({ - trackPage: vi.fn(), - trackClick: vi.fn(), - trackCurrentPage: vi.fn(), - usePageTracking: vi.fn(), - })), - useRouteSynchro: vi.fn(() => {}), - }; -}); - -describe('Form.page', () => { - it('should render select LegalForms correctly when the sub is FR and legalForms is other', async () => { - const { getByText } = renderComponent(); - - expect(getByText('Layout')).not.toBeNull(); - }); -}); diff --git a/packages/manager/apps/hub-react/src/pages/layout.tsx b/packages/manager/apps/hub-react/src/pages/layout.tsx deleted file mode 100644 index 2255576cefc8..000000000000 --- a/packages/manager/apps/hub-react/src/pages/layout.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React, { useEffect, useContext } from 'react'; -import { defineCurrentPage } from '@ovh-ux/request-tagger'; -import { useLocation } from 'react-router-dom'; -import { - useOvhTracking, - useRouteSynchro, - ShellContext, -} from '@ovh-ux/manager-react-shell-client'; - -export default function Layout() { - const location = useLocation(); - const { shell } = useContext(ShellContext); - const { trackCurrentPage } = useOvhTracking(); - useRouteSynchro(); - - useEffect(() => { - defineCurrentPage(`app.dashboard`); - }, []); - - useEffect(() => { - trackCurrentPage(); - }, [location]); - - useEffect(() => { - shell.ux.hidePreloader(); - }, []); - - return
Layout
; -}