fix: 물건번호 recoil 추가
This commit is contained in:
parent
ee2888b7a8
commit
1ba86c3369
@ -1,9 +1,11 @@
|
||||
'ues client'
|
||||
|
||||
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 { useSetRecoilState } from 'recoil'
|
||||
|
||||
const reducer = (prevState, nextState) => {
|
||||
return { ...prevState, ...nextState }
|
||||
@ -32,6 +34,7 @@ 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')
|
||||
@ -40,6 +43,7 @@ const FloorPlanProvider = ({ children }) => {
|
||||
if (pid === undefined || pid === '' || objectNo === undefined || objectNo === '') {
|
||||
notFound()
|
||||
}
|
||||
setCurrentObjectNo(objectNo)
|
||||
}
|
||||
|
||||
const [floorPlanState, setFloorPlanState] = useState({
|
||||
|
||||
@ -217,3 +217,11 @@ export const basicSettingState = atom({
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* 현재 선택된 물건 번호
|
||||
*/
|
||||
export const correntObjectNoState = atom({
|
||||
key: 'correntObjectNoState',
|
||||
default: '',
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user