fix: 도면 작성 url 하위 pid, objectNo 체크 수정

- pid, objectNo 쿼리 파라미터 체크
- 파라미터 누락시 NotFound
This commit is contained in:
yoosangwook 2024-11-28 10:56:16 +09:00
parent 1c6aa023a2
commit bce6f0e0d7

View File

@ -4,7 +4,7 @@ import { correntObjectNoState } from '@/store/settingAtom'
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'
import { createContext, useReducer, useState } from 'react'
import { useSetRecoilState } from 'recoil'
const reducer = (prevState, nextState) => {
@ -40,7 +40,7 @@ const FloorPlanProvider = ({ children }) => {
const pid = searchParams.get('pid')
if (pathname === '/floor-plan') {
if (pid === undefined || pid === '' || objectNo === undefined || objectNo === '') {
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
notFound()
}
setCurrentObjectNo(objectNo)
@ -57,10 +57,6 @@ const FloorPlanProvider = ({ children }) => {
pid,
})
useEffect(() => {
console.log('🚀 ~ FloorPlanProvider ~ floorPlanState:', floorPlanState)
}, [floorPlanState])
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
return (