메인 api 2번 호출현상 수정
This commit is contained in:
parent
38cb4005b2
commit
0d122ecdbd
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import { useEffect, useState, useContext } from 'react'
|
||||||
import ProductItem from './ProductItem'
|
import ProductItem from './ProductItem'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
@ -8,17 +8,16 @@ import { useRecoilValue } from 'recoil'
|
|||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { queryStringFormatter } from '@/util/common-utils'
|
import { queryStringFormatter } from '@/util/common-utils'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
|
||||||
import MainSkeleton from '../ui/MainSkeleton'
|
import MainSkeleton from '../ui/MainSkeleton'
|
||||||
|
import { SessionContext } from '@/app/SessionProvider'
|
||||||
|
|
||||||
export default function MainContents() {
|
export default function MainContents() {
|
||||||
|
const { session } = useContext(SessionContext)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
const { promiseGet } = useAxios(globalLocaleState)
|
const { promiseGet } = useAxios(globalLocaleState)
|
||||||
|
|
||||||
const sessionState = useRecoilValue(sessionStore)
|
|
||||||
|
|
||||||
//최근 물건
|
//최근 물건
|
||||||
const [objectList, setObjectList] = useState([])
|
const [objectList, setObjectList] = useState([])
|
||||||
|
|
||||||
@ -36,12 +35,12 @@ export default function MainContents() {
|
|||||||
fetchObjectList()
|
fetchObjectList()
|
||||||
fetchNoticeList()
|
fetchNoticeList()
|
||||||
fetchFaqList()
|
fetchFaqList()
|
||||||
}, [sessionState])
|
}, [])
|
||||||
|
|
||||||
//최근 갱신 물건목록 / Sales Contact info 정보
|
//최근 갱신 물건목록 / Sales Contact info 정보
|
||||||
const fetchObjectList = async () => {
|
const fetchObjectList = async () => {
|
||||||
try {
|
try {
|
||||||
const apiUrl = `/api/main-page/object/${sessionState?.storeId}/list`
|
const apiUrl = `/api/main-page/object/${session?.storeId}/list`
|
||||||
await promiseGet({
|
await promiseGet({
|
||||||
url: apiUrl,
|
url: apiUrl,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user