feat: floor-plan 링크 수정
This commit is contained in:
parent
0f0643adc1
commit
f3b19f85a2
@ -1,5 +1,6 @@
|
||||
'ues client'
|
||||
|
||||
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
||||
// import { ErrorBoundary } from 'next/dist/client/components/error-boundary'
|
||||
// import ServerError from '../error'
|
||||
import { createContext, useEffect, useReducer, useState } from 'react'
|
||||
@ -30,19 +31,34 @@ export const FloorPlanContext = createContext({
|
||||
})
|
||||
|
||||
const FloorPlanProvider = ({ children }) => {
|
||||
const pathname = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
const objectNo = searchParams.get('objectNo')
|
||||
const pid = searchParams.get('pid')
|
||||
|
||||
if (pathname === '/floor-plan') {
|
||||
if (pid === undefined || pid === '' || objectNo === undefined || objectNo === '') {
|
||||
notFound()
|
||||
}
|
||||
}
|
||||
|
||||
const [floorPlanState, setFloorPlanState] = useState({
|
||||
// 플랜 파일 업로드 모달 오픈 제어
|
||||
refFileModalOpen: false,
|
||||
// 플랜 회전 모드 제어
|
||||
toggleRotate: false,
|
||||
// 물건 번호
|
||||
objectNo,
|
||||
// 플랜 번호
|
||||
pid,
|
||||
})
|
||||
|
||||
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ floorPlanState:', floorPlanState)
|
||||
console.log('🚀 ~ FloorPlanProvider ~ floorPlanState:', floorPlanState)
|
||||
}, [floorPlanState])
|
||||
|
||||
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
|
||||
|
||||
return (
|
||||
<FloorPlanContext.Provider value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState }}>
|
||||
{children}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
'use client'
|
||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||
|
||||
import FloorPlanProvider from './FloorPlanProvider'
|
||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||
|
||||
export default function FloorPlanLayout({ children }) {
|
||||
console.log('FloorPlanLayout')
|
||||
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')
|
||||
|
||||
return (
|
||||
<>
|
||||
<FloorPlanProvider>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user