Skip to content

Commit

Permalink
🎉 에러 핸들링 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
oaoong committed Nov 2, 2023
1 parent 06fab58 commit c33e23b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/app/(root)/(routes)/(home)/components/TestBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// 'use client'
import React, { useEffect } from 'react'
import React from 'react'
import { getTest } from '@/services/test/test'

async function getTestValue() {
const res = await getTest()
const data = await res.json()
return data
try {
const res = await getTest()
const data = await res.json()
return data
} catch (e) {
console.log(e)
}
}

export default async function TestBlock() {
const data = await getTestValue()
console.log(data.message)

// useEffect(() => {
// async function fetchData() {
Expand All @@ -20,5 +23,5 @@ export default async function TestBlock() {
// fetchData()
// }, [])

return <div>{'index ' + data.message}</div>
return <div>{'index ' + data?.message}</div>
}

0 comments on commit c33e23b

Please sign in to comment.