Skip to content

Commit

Permalink
fix(hub): added content language header on notification call
Browse files Browse the repository at this point in the history
ref: MANAGER-14935

Signed-off-by: Jacques Larique <[email protected]>
  • Loading branch information
Jacques Larique authored and JacquesLarique committed Oct 24, 2024
1 parent f6afc19 commit f085cb6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 89 deletions.
6 changes: 6 additions & 0 deletions packages/manager/apps/hub-react/src/data/api/notifications.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -7,6 +8,11 @@ const hubNotificationStatuses = ['warning', 'error'];
export const getNotifications: () => Promise<Notification[]> = async () => {
const { data } = await aapi.get<ApiEnvelope<NotificationsList>>(
`/hub/notifications`,
{
headers: {
'Content-Language': i18next.language.replace('-', '_'),
},
},
);
return (
data.data?.notifications.data || []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const queryClient = new QueryClient();
const wrapper = ({ children }: PropsWithChildren) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
vi.mock('i18next', () => ({
default: {
language: 'fr_FR',
},
}));

describe('useFetchHubNotifications', () => {
it('should return notifications after extracting them from api envelope', async () => {
Expand Down
60 changes: 0 additions & 60 deletions packages/manager/apps/hub-react/src/pages/layout.test.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions packages/manager/apps/hub-react/src/pages/layout.tsx

This file was deleted.

0 comments on commit f085cb6

Please sign in to comment.