Skip to content

Commit

Permalink
Merge branch 'nested-routes-for-admin-page-#1211' into nested-routes-…
Browse files Browse the repository at this point in the history
…for-system-#1213
  • Loading branch information
joshuadkitenge committed Jan 8, 2025
2 parents b6345f9 + 6c70eee commit 0d2d3e7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,15 @@ let router: Router;
const isUsingMSW =
import.meta.env.DEV || import.meta.env.VITE_APP_INCLUDE_MSW === 'true';

if (!isUsingMSW) {
router = createBrowserRouter(routeObject);
}
if (!isUsingMSW) router = createBrowserRouter(routeObject);

// If the application is using MSW (Mock Service Worker),
// it creates the router using `createBrowserRouter` within the App so it can wait for MSW to load. This is necessary
// because MSW needs to be running before the router is created to handle requests properly in the loader. In a production
// environment, this is not needed.

export default function App() {
if (isUsingMSW) {
router = createBrowserRouter(routeObject);
return <RouterProvider router={router} />;
}
if (isUsingMSW) router = createBrowserRouter(routeObject);
return <RouterProvider router={router} />;
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/manufacturers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ const getManufacturer = async (id: string): Promise<Manufacturer> => {
.get(`/v1/manufacturers/${id}`)
.then((response) => response.data);
};
export const getManufacturerQuery = (id?: string | null, loader?: boolean) =>
export const getManufacturerQuery = (id?: string | null, retry?: boolean) =>
queryOptions<Manufacturer, AxiosError>({
queryKey: ['Manufacturer', id],
queryFn: () => getManufacturer(id ?? ''),
enabled: !!id,
retry: loader ? false : undefined,
retry: retry ? false : undefined,
});

export const useGetManufacturer = (
Expand Down
3 changes: 3 additions & 0 deletions src/app.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export interface AllowedValuesList {
values: { av_placement_id: string; value: any }[];
};
}

// ------------------------------------ CATALOGUE CATEGORIES ------------------------------------

export type AllowedValues = AllowedValuesList;

export interface AddCatalogueCategoryProperty {
Expand Down
2 changes: 1 addition & 1 deletion src/manufacturer/manufacturerLayout.component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Manufacturer Layout', () => {
expect(mockedUseNavigate).toHaveBeenCalledTimes(1);
expect(mockedUseNavigate).toHaveBeenCalledWith('/manufacturers');
});
it('navigates back to the root directory from landing page', async () => {
it('navigates back to the root directory from landing page', async () => {
createView('/manufacturers/1', true);

await waitFor(() => {
Expand Down

0 comments on commit 0d2d3e7

Please sign in to comment.