😱fix: currentObjectNo set 구문 위치 수정
- FloorPlanProvider -> FloorPlan
This commit is contained in:
parent
898aa6ec78
commit
b8b45f29b1
@ -42,19 +42,17 @@ export const FloorPlanContext = createContext({
|
||||
})
|
||||
|
||||
const FloorPlanProvider = ({ children }) => {
|
||||
const pathname = usePathname()
|
||||
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
const pid = searchParams.get('pid')
|
||||
|
||||
//useEffect(() => { // 오류 발생으로 useEffect 사용
|
||||
if (pathname === '/floor-plan') {
|
||||
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||
notFound()
|
||||
}
|
||||
setCurrentObjectNo(objectNo)
|
||||
}
|
||||
// if (pathname === '/floor-plan') {
|
||||
// if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||
// notFound()
|
||||
// }
|
||||
// setCurrentObjectNo(objectNo)
|
||||
// }
|
||||
//}, [pid, objectNo])
|
||||
|
||||
const [floorPlanState, setFloorPlanState] = useState({
|
||||
|
||||
@ -1,31 +1,22 @@
|
||||
'use client'
|
||||
|
||||
import { usePathname } from 'next/navigation'
|
||||
import FloorPlanProvider from './FloorPlanProvider'
|
||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||
import { Suspense } from 'react'
|
||||
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
|
||||
|
||||
export default function FloorPlanLayout({ children }) {
|
||||
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
|
||||
const pathname = usePathname()
|
||||
console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Suspense fallback={<GlobalSpinner />}>
|
||||
<FloorPlanProvider>
|
||||
<FloorPlan>
|
||||
{/* {pathname.includes('estimate') || pathname.includes('simulator') ? (
|
||||
<FloorPlanProvider>
|
||||
<FloorPlan>
|
||||
{/* {pathname.includes('estimate') || pathname.includes('simulator') ? (
|
||||
<div className="canvas-layout">{children}</div>
|
||||
) : (
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
)} */}
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
</FloorPlan>
|
||||
</FloorPlanProvider>
|
||||
</Suspense>
|
||||
<CanvasLayout>{children}</CanvasLayout>
|
||||
</FloorPlan>
|
||||
</FloorPlanProvider>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,18 +1,28 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
//import { useRecoilState } from 'recoil'
|
||||
import CanvasMenu from '@/components/floor-plan/CanvasMenu'
|
||||
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
|
||||
import { usePopup } from '@/hooks/usePopup'
|
||||
//import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
//import { correntObjectNoState } from '@/store/settingAtom'
|
||||
import '@/styles/contents.scss'
|
||||
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
||||
import { useSetRecoilState } from 'recoil'
|
||||
import { correntObjectNoState } from '@/store/settingAtom'
|
||||
|
||||
export default function FloorPlan({ children }) {
|
||||
//const { floorPlanState, setFloorPlanState } = useContext(FloorPlanContext)
|
||||
//const [correntObjectNo, setCorrentObjectNo] = useRecoilState(correntObjectNoState)
|
||||
const pathname = usePathname()
|
||||
const setCurrentObjectNo = useSetRecoilState(correntObjectNoState)
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
const pid = searchParams.get('pid')
|
||||
if (pathname === '/floor-plan') {
|
||||
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||
notFound()
|
||||
}
|
||||
setCurrentObjectNo(objectNo)
|
||||
}
|
||||
|
||||
const { closeAll } = usePopup()
|
||||
const { menuNumber, setMenuNumber } = useCanvasMenu()
|
||||
const { fetchSettings, fetchBasicSettings } = useCanvasSetting()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user