fix: 도면 작성 url 하위 pid, objectNo 체크 수정
- pid, objectNo 쿼리 파라미터 체크 - 파라미터 누락시 NotFound
This commit is contained in:
parent
1c6aa023a2
commit
bce6f0e0d7
@ -4,7 +4,7 @@ import { correntObjectNoState } from '@/store/settingAtom'
|
|||||||
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
||||||
// import { ErrorBoundary } from 'next/dist/client/components/error-boundary'
|
// import { ErrorBoundary } from 'next/dist/client/components/error-boundary'
|
||||||
// import ServerError from '../error'
|
// import ServerError from '../error'
|
||||||
import { createContext, useEffect, useReducer, useState } from 'react'
|
import { createContext, useReducer, useState } from 'react'
|
||||||
import { useSetRecoilState } from 'recoil'
|
import { useSetRecoilState } from 'recoil'
|
||||||
|
|
||||||
const reducer = (prevState, nextState) => {
|
const reducer = (prevState, nextState) => {
|
||||||
@ -40,7 +40,7 @@ const FloorPlanProvider = ({ children }) => {
|
|||||||
const pid = searchParams.get('pid')
|
const pid = searchParams.get('pid')
|
||||||
|
|
||||||
if (pathname === '/floor-plan') {
|
if (pathname === '/floor-plan') {
|
||||||
if (pid === undefined || pid === '' || objectNo === undefined || objectNo === '') {
|
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||||
notFound()
|
notFound()
|
||||||
}
|
}
|
||||||
setCurrentObjectNo(objectNo)
|
setCurrentObjectNo(objectNo)
|
||||||
@ -57,10 +57,6 @@ const FloorPlanProvider = ({ children }) => {
|
|||||||
pid,
|
pid,
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('🚀 ~ FloorPlanProvider ~ floorPlanState:', floorPlanState)
|
|
||||||
}, [floorPlanState])
|
|
||||||
|
|
||||||
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
|
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user