-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from team-nabi/NABI-109
🐛 msw가 ssr에서 정상작동하지 않는 문제 처리
- Loading branch information
Showing
4 changed files
with
45 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
'use client' | ||
|
||
import React, { useEffect } from 'react' | ||
// 'use client' | ||
import React from 'react' | ||
import { getTest } from '@/services/test/test' | ||
|
||
// async function getTestValue() { | ||
// const res = await getTest() | ||
// const data = await res.json() | ||
// return data | ||
// } | ||
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 | ||
} | ||
} | ||
|
||
export default function TestBlock() { | ||
// const data = await getTestValue() | ||
// console.log(data.message) | ||
export default async function TestBlock() { | ||
const data = await getTestValue() | ||
|
||
useEffect(() => { | ||
async function fetchData() { | ||
const data = await getTest() | ||
console.log(await data.json()) | ||
} | ||
fetchData() | ||
}, []) | ||
// useEffect(() => { | ||
// async function fetchData() { | ||
// const data = await getTest() | ||
// console.log(await data.json()) | ||
// } | ||
// fetchData() | ||
// }, []) | ||
|
||
return <div>{'index '}</div> | ||
return <div>{'index ' + data?.message}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
export const Environment = { | ||
apiAddress: () => process.env.NEXT_PUBLIC_API_ADDRESS, | ||
apiAddress: () => | ||
process.env.NEXT_PUBLIC_API_MOCKING === 'enabled' | ||
? process.env.NEXT_PUBLIC_API_MOCKING_ADDRESS | ||
: process.env.NEXT_PUBLIC_API_ADDRESS, | ||
apiMocking: () => | ||
process.env.NEXT_PUBLIC_API_MOCKING === 'enabled' ? 'enabled' : 'disabled', | ||
} |