Skip to content

Commit

Permalink
✨ mock init 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
oaoong committed Nov 2, 2023
1 parent c33e23b commit f965b08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/(root)/(routes)/(home)/components/TestBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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,
Expand Down

0 comments on commit f965b08

Please sign in to comment.