diff --git a/src/app/(root)/(routes)/(home)/components/TestBlock.tsx b/src/app/(root)/(routes)/(home)/components/TestBlock.tsx index 9fa957f3..431a4e03 100644 --- a/src/app/(root)/(routes)/(home)/components/TestBlock.tsx +++ b/src/app/(root)/(routes)/(home)/components/TestBlock.tsx @@ -2,13 +2,14 @@ import React from 'react' import { getTest } from '@/services/test/test' -async function getTestValue() { +async function getTestValue(): Promise<{ message: string } | null> { try { const res = await getTest() const data = await res.json() return data } catch (e) { console.log(e) + return null } } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index c0add4dc..6f9dd813 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,9 +1,11 @@ import { Suspense } from 'react' import type { Metadata } from 'next' import Header from '@/components/domain/Header' +import { Environment } from '@/config/environment' import MSWWrapper from '@/contexts/MSWWrapper' import TanstackQueryContext from '@/contexts/TanstackQueryContext' import ThemeProviderContext from '@/contexts/ThemeProviderContext' +import { initMockApi } from '@/lib/msw/initMockApi' import '@/styles/globals.css' export const metadata: Metadata = { @@ -12,6 +14,11 @@ export const metadata: Metadata = { viewport: 'width=device-width, initial-scale=1.0', } +if (Environment.apiMocking() === 'enabled') { + console.log('Mocking enabled') + initMockApi() +} + export default function RootLayout({ children, authModal,