diff --git a/.env.development b/.env.development index ec409311..357a2f7f 100644 --- a/.env.development +++ b/.env.development @@ -13,8 +13,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK" -NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" -NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order-dev.q-cells.jp/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi-dev.q-cells.jp/qm/login/autoLogin" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/src/components/auth/AutoLogin.jsx b/src/components/auth/AutoLogin.jsx index b3dcbb6e..5de9ea85 100644 --- a/src/components/auth/AutoLogin.jsx +++ b/src/components/auth/AutoLogin.jsx @@ -8,6 +8,7 @@ import { useRecoilState } from 'recoil' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' import { useRouter } from 'next/navigation' +import Cookies from 'js-cookie' import GlobalSpinner from '@/components/common/spinner/GlobalSpinner' @@ -31,6 +32,7 @@ export default function AutoLoginPage({ autoLoginParam }) { setIsLoading(false) if (response.data) { const res = response.data + if (res.sessionId) Cookies.set('sessionId', res.sessionId) const result = { ...res, storeLvl: res.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' } setSession(result) setSessionState(result) diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index 7a6ba957..d20f5320 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -48,6 +48,7 @@ export default function Login() { post({ url: '/api/login/v1.0/user', data: { loginId: res.data } }).then((response) => { setIsLoading(false) if (response) { + if (response.sessionId) Cookies.set('sessionId', response.sessionId) const result = { ...response, storeLvl: response.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' } setSession(result) setSessionState(result) @@ -107,6 +108,7 @@ export default function Login() { if (res) { setIsLoading(false) if (res.data.result.resultCode === 'S') { + if (res.data.sessionId) Cookies.set('sessionId', res.data.sessionId) setSession(res.data.data) setSessionState(res.data.data) // ID SAVE 체크되어 있는 경우, 쿠키 저장 diff --git a/src/components/fabric/QLine.js b/src/components/fabric/QLine.js index 2d4294d6..03dd14db 100644 --- a/src/components/fabric/QLine.js +++ b/src/components/fabric/QLine.js @@ -95,6 +95,34 @@ export const QLine = fabric.util.createClass(fabric.Line, { if (this.attributes?.planeSize) { thisText.set({ planeSize: this.attributes.planeSize, text: this.attributes.planeSize.toString() }) } + // 라인이 이동했을 수 있으므로 위치도 재계산해서 업데이트한다. + const sX = this.scaleX + const sY = this.scaleY + const tx1 = this.left + const ty1 = this.top + const tx2 = this.left + this.width * sX + const ty2 = this.top + this.height * sY + let nLeft, nTop + if (this.direction === 'left' || this.direction === 'right') { + nLeft = (tx1 + tx2) / 2 + nTop = (ty1 + ty2) / 2 + 10 + } else if (this.direction === 'top' || this.direction === 'bottom') { + nLeft = (tx1 + tx2) / 2 + 10 + nTop = (ty1 + ty2) / 2 + } else { + // 대각선 + nLeft = (tx1 + tx2) / 2 + nTop = (ty1 + ty2) / 2 + } + thisText.set({ + left: nLeft, + top: nTop, + minX: this.left, + maxX: this.left + this.width, + minY: this.top, + maxY: this.top + this.length, + }) + thisText.setCoords?.() } else { this.setLength() const scaleX = this.scaleX diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index dbe6a9e3..b89e9daf 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -136,9 +136,59 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, { }) this.on('modified', () => { + // 드래그 종료 시점의 delta 계산 (mousedown 에서 저장한 값 사용) + const hasPreDrag = this._preDragLeft != null && this._preDragTop != null + const dxModified = hasPreDrag ? this.left - this._preDragLeft : 0 + const dyModified = hasPreDrag ? this.top - this._preDragTop : 0 + this.initLines() this.addLengthText() this.setCoords() + + // 보조선 / 자식 객체들도 같이 이동시킨다 (ROOF 가 아닌 WALL 등에서도 동작하도록) + if ((dxModified !== 0 || dyModified !== 0) && this.canvas) { + const directChildren = this.canvas.getObjects().filter((obj) => { + if (obj === this) return false + if (obj.parentId !== this.id) return false + if (obj.name === 'lengthText') return false + return true + }) + const childIds = new Set(directChildren.map((c) => c.id).filter(Boolean)) + + directChildren.forEach((obj) => { + const next = {} + if (obj.left != null) next.left = obj.left + dxModified + if (obj.top != null) next.top = obj.top + dyModified + if (obj.x1 != null) next.x1 = obj.x1 + dxModified + if (obj.y1 != null) next.y1 = obj.y1 + dyModified + if (obj.x2 != null) next.x2 = obj.x2 + dxModified + if (obj.y2 != null) next.y2 = obj.y2 + dyModified + obj.set(next) + if (obj.startPoint) obj.startPoint = { x: obj.startPoint.x + dxModified, y: obj.startPoint.y + dyModified } + if (obj.endPoint) obj.endPoint = { x: obj.endPoint.x + dxModified, y: obj.endPoint.y + dyModified } + obj.setCoords?.() + }) + + let movedTextCount = 0 + this.canvas.getObjects().forEach((obj) => { + if (childIds.size > 0 && childIds.has(obj.parentId)) { + obj.set({ left: (obj.left ?? 0) + dxModified, top: (obj.top ?? 0) + dyModified }) + if (obj.minX != null) obj.minX += dxModified + if (obj.maxX != null) obj.maxX += dxModified + if (obj.minY != null) obj.minY += dyModified + if (obj.maxY != null) obj.maxY += dyModified + obj.setCoords?.() + movedTextCount++ + } + }) + this.canvas.renderAll() + + // ROOF 의 경우 polygonMoved 가 같은 일을 다시 하므로, _preDragLeft 는 거기서 정리됨 + if (this.name !== POLYGON_TYPE.ROOF) { + this._preDragLeft = null + this._preDragTop = null + } + } }) this.on('selected', () => { @@ -168,9 +218,20 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, { }) }) + // 드래그 시작 전 위치를 기록해두고 polygonMoved 에서 델타 계산용으로 사용 + this.on('mousedown', () => { + this._preDragLeft = this.left + this._preDragTop = this.top + }) + //QPolygon 좌표 이동시 좌표 재계산 this.on('polygonMoved', () => { //폴리곤일때만 사용 + // 드래그 전 left/top 이 있으면 delta 계산, 없으면 0 + const hasPreDrag = this._preDragLeft != null && this._preDragTop != null + const deltaX = hasPreDrag ? this.left - this._preDragLeft : 0 + const deltaY = hasPreDrag ? this.top - this._preDragTop : 0 + let matrix = this.calcTransformMatrix() let transformedPoints = this.get('points') @@ -204,6 +265,64 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, { this.setCoords() this.initLines() + // 이동 후 기존 lengthText 가 이전 위치에 남아있지 않도록 재생성 + this.addLengthText() + + // 보조선(helpLine 등) 및 그 부속 객체(lengthText, pitchText 등)를 폴리곤 이동량만큼 같이 이동 + if ((deltaX !== 0 || deltaY !== 0) && this.canvas) { + // drawHelpLine 이 추가하는 보조선들은 this.innerLines 배열에 들어가지 않을 수 있으므로 + // canvas 에서 parentId === this.id 인 자식 객체들을 직접 찾는다. + // (단, 이 폴리곤의 outer lengthText 는 위에서 addLengthText() 로 이미 재생성했으므로 제외) + const directChildren = this.canvas.getObjects().filter((obj) => { + if (obj === this) return false + if (obj.parentId !== this.id) return false + if (obj.name === 'lengthText') return false // 이미 재생성됨 + return true + }) + + const childIds = new Set(directChildren.map((c) => c.id).filter(Boolean)) + + const translateLineLike = (obj) => { + const next = {} + if (obj.left != null) next.left = obj.left + deltaX + if (obj.top != null) next.top = obj.top + deltaY + if (obj.x1 != null) next.x1 = obj.x1 + deltaX + if (obj.y1 != null) next.y1 = obj.y1 + deltaY + if (obj.x2 != null) next.x2 = obj.x2 + deltaX + if (obj.y2 != null) next.y2 = obj.y2 + deltaY + obj.set(next) + if (obj.startPoint) { + obj.startPoint = { x: obj.startPoint.x + deltaX, y: obj.startPoint.y + deltaY } + } + if (obj.endPoint) { + obj.endPoint = { x: obj.endPoint.x + deltaX, y: obj.endPoint.y + deltaY } + } + obj.setCoords?.() + } + + directChildren.forEach(translateLineLike) + + // 보조선의 텍스트(lengthText, pitchText 등)는 보조선 line.id 를 parentId 로 가짐 -> 같이 이동 + let movedTextCount = 0 + this.canvas.getObjects().forEach((obj) => { + if (childIds.size > 0 && childIds.has(obj.parentId)) { + obj.set({ + left: (obj.left ?? 0) + deltaX, + top: (obj.top ?? 0) + deltaY, + }) + if (obj.minX != null) obj.minX += deltaX + if (obj.maxX != null) obj.maxX += deltaX + if (obj.minY != null) obj.minY += deltaY + if (obj.maxY != null) obj.maxY += deltaY + obj.setCoords?.() + movedTextCount++ + } + }) + this.canvas.renderAll() + } + + this._preDragLeft = null + this._preDragTop = null }) // polygon.fillCell({ width: 50, height: 30, padding: 10 }) diff --git a/src/components/floor-plan/modal/basic/BasicSetting.jsx b/src/components/floor-plan/modal/basic/BasicSetting.jsx index b887747b..f668acfb 100644 --- a/src/components/floor-plan/modal/basic/BasicSetting.jsx +++ b/src/components/floor-plan/modal/basic/BasicSetting.jsx @@ -18,7 +18,6 @@ import { currentCanvasPlanState, isManualModuleLayoutSetupState, isManualModuleSetupState, - moduleSetupOptionState, toggleManualSetupModeState, } from '@/store/canvasAtom' import { loginUserStore } from '@/store/commonAtom' @@ -50,7 +49,6 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { const [checkedModules, setCheckedModules] = useRecoilState(checkedModuleState) const [roofs, setRoofs] = useState(addedRoofs) const [manualSetupMode, setManualSetupMode] = useRecoilState(toggleManualSetupModeState) - const [moduleSetupOption, setModuleSetupOption] = useRecoilState(moduleSetupOptionState) const [layoutSetup, setLayoutSetup] = useState([{}]) const { selectedModules, @@ -220,12 +218,8 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { } const handleManualModuleSetup = () => { - const nextManual = !isManualModuleSetup - setManualSetupMode(`manualSetup_${nextManual}`) - setIsManualModuleSetup(nextManual) - if (nextManual) { - setModuleSetupOption((prev) => ({ ...prev, isChidori: true })) - } + setManualSetupMode(`manualSetup_${!isManualModuleSetup}`) + setIsManualModuleSetup(!isManualModuleSetup) } const handleManualModuleLayoutSetup = () => { diff --git a/src/components/floor-plan/modal/circuitTrestle/step/StepUp.jsx b/src/components/floor-plan/modal/circuitTrestle/step/StepUp.jsx index f8ae00ad..2fc0c38f 100644 --- a/src/components/floor-plan/modal/circuitTrestle/step/StepUp.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/step/StepUp.jsx @@ -130,6 +130,7 @@ export default function StepUp(props) { if (selectedSerQty) { selectedSerQty.roofSurfaceList.forEach((roofSurface) => { const targetSurface = canvas.getObjects().filter((obj) => obj.id === roofSurface.roofSurfaceId)[0] + if (!targetSurface) return const moduleIds = targetSurface.modules.map((module) => module.id) /** 기존 모듈 텍스트 삭제 */ @@ -406,37 +407,94 @@ export default function StepUp(props) { /** * 행 선택 핸들러 함수 추가 */ + /** + * 주어진 stepUpListData 를 기준으로 캔버스의 모든 module circuit 텍스트를 다시 그린다. + * 모든 pcsItem 의 selected serQty 를 순회해 적용한다. + */ + const applyCircuitsToCanvas = (stepUpListSrc) => { + if (!stepUpListSrc?.[0]?.pcsItemList) return + + /** 모든 모듈 circuit 데이터 초기화 */ + canvas + .getObjects() + .filter((obj) => obj.name === POLYGON_TYPE.MODULE) + .forEach((module) => { + module.circuit = null + module.circuitNumber = null + module.pcsItemId = null + }) + + /** 기존 circuit 텍스트 객체 모두 제거 */ + canvas + .getObjects() + .filter((obj) => obj.name === 'circuitNumber') + .forEach((text) => canvas.remove(text)) + + stepUpListSrc[0].pcsItemList.forEach((pcsItem) => { + const sel = pcsItem.serQtyList?.find((sq) => sq.selected) + if (!sel) return + sel.roofSurfaceList.forEach((roofSurface) => { + const targetSurface = canvas.getObjects().filter((obj) => obj.id === roofSurface.roofSurfaceId)[0] + if (!targetSurface) return + + roofSurface.moduleList.forEach((module) => { + const targetModule = canvas.getObjects().find((obj) => obj.id === module.uniqueId) + if (targetModule && module.circuit !== '' && module.circuit !== null) { + const moduleCircuitText = new fabric.Text(module.circuit, { + left: targetModule.left + targetModule.width / 2, + top: targetModule.top + targetModule.height / 2, + fontFamily: circuitNumberText.fontFamily.value, + fontWeight: circuitNumberText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', + fontStyle: circuitNumberText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', + fontSize: circuitNumberText.fontSize.value, + fill: circuitNumberText.fontColor.value, + width: targetModule.width, + height: targetModule.height, + textAlign: 'center', + originX: 'center', + originY: 'center', + name: 'circuitNumber', + parentId: targetModule.id, + circuitInfo: module.pcsItemId, + visible: isDisplayCircuitNumber, + }) + targetModule.circuit = moduleCircuitText + targetModule.pcsItemId = module.pcsItemId + targetModule.circuitNumber = module.circuit + canvas.add(moduleCircuitText) + } + }) + }) + }) + + canvas.renderAll() + setModuleStatisticsData() + } + const handleRowClick = (mainIdx, subIdx, applyParalQty = null) => { /** 자동 승압 설정인 경우만 실행 */ if (allocationType !== 'auto') return let tempStepUpListData = [...stepUpListData] - let selectedData = {} tempStepUpListData[0].pcsItemList[mainIdx].serQtyList.forEach((item, index) => { - if (index === subIdx) { - selectedData = item - } item.selected = index === subIdx }) /** 선택된 행 정보 저장 */ setStepUpListData(tempStepUpListData) /** PCS 2개 이상 또는 첫번째 PCS 선택 시에만 실행 */ - if (tempStepUpListData[0].pcsItemList.length > 1 && mainIdx === 0) { + const needsRefetch = + tempStepUpListData[0].pcsItemList.length > 1 && mainIdx === 0 + + if (needsRefetch) { /** 파워컨디셔너 옵션 조회 요청 파라미터 */ const params = { ...props.getOptYn(), // 옵션 Y/N useModuleItemList: props.getUseModuleItemList(), // 사용된 모듈아이템 List roofSurfaceList: props.getRoofSurfaceList(), // 지붕면 목록 pcsItemList: props.getSelectedPcsItemList().map((pcsItem, index) => { - /** PCS 아이템 목록 - * tempStepUpListData에서 해당 PCS 아이템 찾기 - * uniqueIndex를 사용하여 매칭 - */ const matchingPcsItem = tempStepUpListData[0].pcsItemList.find((item) => item.uniqueIndex === `${pcsItem.itemId}_${index}`) - - /** 선택된 serQty 찾기 */ const selectedSerQty = matchingPcsItem?.serQtyList.find((serQty) => serQty.selected)?.serQty || 0 if (index === 0) { return { @@ -453,86 +511,30 @@ export default function StepUp(props) { } /** PCS가 1개 이고 2번째 또는 3번째 PCS serQty가 0인 경우는 추천 API 실행하지 않음 */ - if (params.pcsItemList.length !== 1 && (params.pcsItemList[1]?.applySerQty !== 0 || params.pcsItemList[2]?.applySerQty) !== 0) { - /** PCS 승압설정 정보 조회 */ + const skipApi = !(params.pcsItemList.length !== 1 && (params.pcsItemList[1]?.applySerQty !== 0 || params.pcsItemList[2]?.applySerQty) !== 0) + + if (!skipApi) { + /** + * PCS 승압설정 정보 조회. 캔버스 갱신은 응답을 받은 뒤에 수행해야 + * "한박자 늦게" 반영되는 stale state 문제가 발생하지 않는다. + */ getPcsVoltageStepUpList(params).then((res) => { if (res?.result.resultCode === 'S' && res?.data) { const dataArray = Array.isArray(res.data) ? res.data : [res.data] - const stepUpListData = formatStepUpListData(dataArray) - - /** PCS 승압설정 정보 SET */ - setStepUpListData(stepUpListData) - - /** PCS 옵션 조회 */ - // const formattedOptCodes = formatOptionCodes(res.data.optionList) - // setOptCodes(formattedOptCodes) - // setSeletedOption(formattedOptCodes[0]) + const newStepUpListData = formatStepUpListData(dataArray) + setStepUpListData(newStepUpListData) + applyCircuitsToCanvas(newStepUpListData) } else { swalFire({ text: getMessage('common.message.send.error') }) + applyCircuitsToCanvas(tempStepUpListData) } }) + return } } - /** 모듈 목록 삭제 */ - canvas - .getObjects() - .filter((obj) => obj.name === POLYGON_TYPE.MODULE) - .forEach((module) => { - module.circuit = null - module.circuitNumber = null - module.pcsItemId = null - }) - - /** 선택된 모듈 목록 추가 */ - selectedData.roofSurfaceList.forEach((roofSurface) => { - const targetSurface = canvas.getObjects().filter((obj) => obj.id === roofSurface.roofSurfaceId)[0] - const moduleIds = targetSurface.modules.map((module) => { - return module.id - }) - - /** 모듈 목록 삭제 */ - canvas - .getObjects() - .filter((obj) => moduleIds.includes(obj.parentId)) - .map((text) => { - canvas.remove(text) - }) - - /** 모듈 목록 추가 */ - canvas.renderAll() - - roofSurface.moduleList.forEach((module) => { - const targetModule = canvas.getObjects().find((obj) => obj.id === module.uniqueId) - if (targetModule && module.circuit !== '' && module.circuit !== null) { - const moduleCircuitText = new fabric.Text(module.circuit, { - left: targetModule.left + targetModule.width / 2, - top: targetModule.top + targetModule.height / 2, - fontFamily: circuitNumberText.fontFamily.value, - fontWeight: circuitNumberText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal', - fontStyle: circuitNumberText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal', - fontSize: circuitNumberText.fontSize.value, - fill: circuitNumberText.fontColor.value, - width: targetModule.width, - height: targetModule.height, - textAlign: 'center', - originX: 'center', - originY: 'center', - name: 'circuitNumber', - parentId: targetModule.id, - circuitInfo: module.pcsItemId, - visible: isDisplayCircuitNumber, - }) - targetModule.circuit = moduleCircuitText - targetModule.pcsItemId = module.pcsItemId - targetModule.circuitNumber = module.circuit - canvas.add(moduleCircuitText) - } - }) - }) - - canvas.renderAll() - setModuleStatisticsData() + /** API 재조회가 없는 경로: 현재 tempStepUpListData 로 즉시 캔버스 갱신 */ + applyCircuitsToCanvas(tempStepUpListData) } /** diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index ce2667fe..c0153c7b 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -268,15 +268,14 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla }, { skipSideEffects: true }) const roofs = canvas.getObjects().filter((obj) => obj.roofMaterial?.index === 0) - const firstRoof = roofs[0] - if (firstRoof) { + roofs.forEach((roof) => { /** 모양 패턴 설정 */ - setSurfaceShapePattern(firstRoof, roofDisplay.column, false, { ...roofInfo }) - firstRoof.roofMaterial = { ...roofInfo } - drawDirectionArrow(firstRoof) - setPolygonLinesActualSize(firstRoof, true) - } + setSurfaceShapePattern(roof, roofDisplay.column, false, { ...roofInfo }) + roof.roofMaterial = { ...roofInfo } + drawDirectionArrow(roof) + setPolygonLinesActualSize(roof, true) + }) canvas.renderAll() /** 지붕면 존재 여부에 따라 메뉴 설정 */ diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index 561b8e47..8c2ccbff 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -8,7 +8,8 @@ import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil' import { dimmedStore, sessionStore } from '@/store/commonAtom' import { useMessage } from '@/hooks/useMessage' -import { checkSession, logout } from '@/lib/authActions' +import { checkSession } from '@/lib/authActions' +import { useLogout } from '@/hooks/useLogout' import QSelectBox from '@/components/common/select/QSelectBox' @@ -49,6 +50,7 @@ export default function Header(props) { const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState) const { closeAll } = usePopup() + const { logoutProcess } = useLogout() const { userSession } = props const [sessionState, setSessionState] = useRecoilState(sessionStore) @@ -372,14 +374,7 @@ export default function Header(props) {
diff --git a/src/components/main/ChangePasswordPop.jsx b/src/components/main/ChangePasswordPop.jsx index 28dc537c..58c22d69 100644 --- a/src/components/main/ChangePasswordPop.jsx +++ b/src/components/main/ChangePasswordPop.jsx @@ -5,10 +5,10 @@ import { sessionStore } from '@/store/commonAtom' import { useRecoilState, useRecoilValue } from 'recoil' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' -import { login, logout, setSession } from '@/lib/authActions' +import { login, setSession } from '@/lib/authActions' import { useSwal } from '@/hooks/useSwal' import { QcastContext } from '@/app/QcastProvider' -import { useRouter } from 'next/navigation' +import { useLogout } from '@/hooks/useLogout' export default function ChangePasswordPop(props) { const globalLocaleState = useRecoilValue(globalLocaleStore) @@ -19,7 +19,7 @@ export default function ChangePasswordPop(props) { const { patch } = useAxios(globalLocaleState) const { getMessage } = useMessage() const [sessionState, setSessionState] = useRecoilState(sessionStore) - const router = useRouter() + const { logoutProcess } = useLogout() const formInitValue = { password1: '', password2: '', @@ -129,15 +129,13 @@ export default function ChangePasswordPop(props) { } } else { setIsGlobalLoading(false) - logout() - router.replace('/login', undefined, { shallow: true }) + logoutProcess() console.log('code not 200 error') } }) .catch((error) => { setIsGlobalLoading(false) - logout() - router.replace('/login', undefined, { shallow: true }) + logoutProcess() console.log('catch::::::::', error) }) } @@ -209,10 +207,7 @@ export default function ChangePasswordPop(props) { diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 12eef9ff..341e537d 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -1868,7 +1868,7 @@ export default function StuffDetail() { })} {/* 라디오끝 */}
- +
+