Skip to content

Commit 7d1d56e

Browse files
mathieumousnierRomain Jamet
authored andcommitted
refactor(omks): move location api to common
ref: #MANAGER-18827 Signed-off-by: Mathieu Mousnier <[email protected]>
1 parent 7b382a1 commit 7d1d56e

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

packages/manager/apps/okms/src/common/components/regionPicker/RegionPicker.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { OdsSpinner } from '@ovhcloud/ods-components/react';
3-
import { useLocations } from '@secret-manager/data/hooks/useLocation';
3+
import { useLocations } from '@/common/data/hooks/useLocation';
44
import { useRegionName } from '@/hooks/useRegionName';
55
import { RadioCard } from '../RadioCard/RadioCard.component';
66
import { RegionTypeBadge } from '@/components/regionTypeBadge/RegionTypeBadge.component';
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { useQuery } from '@tanstack/react-query';
22
import { Location } from '@secret-manager/types/location.type';
33
import { ErrorResponse } from '@/types/api.type';
4-
import {
5-
getLocations,
6-
locationQueryKeys,
7-
} from '@/modules/secret-manager/data/api/location';
4+
import { getLocations, locationQueryKeys } from '@/common/data/api/location';
85

96
export const useLocations = () => {
107
return useQuery<Location[], ErrorResponse>({

packages/manager/apps/okms/src/modules/secret-manager/hooks/useRegionSelector.spec.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ vi.mock('react-router-dom', () => ({
2525
}));
2626

2727
// Mock the useLocations fetch function
28-
vi.mock('@/modules/secret-manager/data/api/location', async () => {
29-
const actual = await vi.importActual(
30-
'@/modules/secret-manager/data/api/location',
31-
);
28+
vi.mock('@/common/data/api/location', async () => {
29+
const actual = await vi.importActual('@/common/data/api/location');
3230
return {
3331
...actual,
3432
getLocations: vi.fn().mockResolvedValue(locationsMock),
@@ -54,7 +52,7 @@ import { getOkmsList } from '@/data/api/okms';
5452
const mockGetOkmsList = vi.mocked(getOkmsList);
5553

5654
// eslint-disable-next-line import/first, import/newline-after-import
57-
import { getLocations } from '@/modules/secret-manager/data/api/location';
55+
import { getLocations } from '@/common/data/api/location';
5856
const mockGetLocations = vi.mocked(getLocations);
5957

6058
// Mock the useCurrentRegion hook

packages/manager/apps/okms/src/modules/secret-manager/hooks/useRegionSelector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useMemo } from 'react';
22
import { Location } from '@secret-manager/types/location.type';
33
import { SECRET_MANAGER_ROUTES_URLS } from '@secret-manager/routes/routes.constants';
4-
import { useLocations } from '@secret-manager/data/hooks/useLocation';
54
import { useCurrentRegion } from '@secret-manager/hooks/useCurrentRegion';
5+
import { useLocations } from '@/common/data/hooks/useLocation';
66
import { useOkmsList } from '@/data/hooks/useOkms';
77
import { findLocationByRegion } from '@/modules/secret-manager/utils/location';
88
import { OKMS } from '@/types/okms.type';

0 commit comments

Comments
 (0)