From bf26864f61cbda31c3f4a0ebc0a5d2c0e67ae235 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 11:04:22 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EB=A1=9C=EC=A7=81=20=EB=B0=98=EB=B3=B5=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=90=98=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/layout.js | 12 ++++++------ src/components/header/Header.jsx | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/layout.js b/src/app/layout.js index 3383aa10..2aa1a30a 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -51,13 +51,13 @@ export default async function RootLayout({ children }) { } } - if (!headerPathname.includes('/login') && !session.isLoggedIn) { - redirect('/login') - } + // if (!headerPathname.includes('/login') && !session.isLoggedIn) { + // redirect('/login') + // } - if (headerPathname === '/login' && session.isLoggedIn) { - redirect('/') - } + // if (headerPathname === '/login' && session.isLoggedIn) { + // redirect('/') + // } return ( diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index b8cfafd2..2e2e98cd 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -85,9 +85,9 @@ export default function Header(props) { }) } - useEffect(() => { - getAutoLoginParam() - }, [userSession]) + // useEffect(() => { + // getAutoLoginParam() + // }, [userSession]) const menus = [ { id: 0, name: 'header.menus.home', url: '/', children: [] }, From c1fb6a08cafaf0d81b5e06c6f46f25b371bf9d16 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 11:20:19 +0900 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=8F=84=EB=A9=B4=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20=EB=B2=84=ED=8A=BC=20=EC=95=88=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/Login.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index af50a515..d53bd12d 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -87,6 +87,7 @@ export default function Login() { } await promisePost({ url: '/api/login/v1.0/login', data: param }) .then((res) => { + console.log('๐Ÿš€ ~ .then ~ res:', res) if (res) { if (res.data.result.resultCode === 'S') { setSession(res.data.data) @@ -97,7 +98,7 @@ export default function Login() { } else { Cookies.remove('chkLoginId') } - router.push('/') + // router.push('/') } else { alert(res.data.result.resultMsg) } @@ -106,6 +107,8 @@ export default function Login() { .catch((error) => { alert(error.response.data.message) }) + + router.push('/') } // ๋น„๋ฐ€๋ฒˆํ˜ธ ์ดˆ๊ธฐํ™” ๊ด€๋ จ From 4977abcf35993fb3764000696b618a8b2ac522ab Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 13:18:57 +0900 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=B2=98=EB=A6=AC=20=EC=9B=90=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/layout.js | 12 ++++++------ src/components/auth/Login.jsx | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app/layout.js b/src/app/layout.js index 2aa1a30a..3383aa10 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -51,13 +51,13 @@ export default async function RootLayout({ children }) { } } - // if (!headerPathname.includes('/login') && !session.isLoggedIn) { - // redirect('/login') - // } + if (!headerPathname.includes('/login') && !session.isLoggedIn) { + redirect('/login') + } - // if (headerPathname === '/login' && session.isLoggedIn) { - // redirect('/') - // } + if (headerPathname === '/login' && session.isLoggedIn) { + redirect('/') + } return ( diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index d53bd12d..98f7a5b6 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -98,7 +98,7 @@ export default function Login() { } else { Cookies.remove('chkLoginId') } - // router.push('/') + router.push('/') } else { alert(res.data.result.resultMsg) } @@ -107,8 +107,6 @@ export default function Login() { .catch((error) => { alert(error.response.data.message) }) - - router.push('/') } // ๋น„๋ฐ€๋ฒˆํ˜ธ ์ดˆ๊ธฐํ™” ๊ด€๋ จ From e07d61dc5f846720c9fe2122d5ce8c4cb99b2fa9 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 18 Dec 2024 13:27:05 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=EC=A7=80=EB=B6=95=EC=9E=AC=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placementShape/PlacementShapeSetting.jsx | 2 +- .../roofAllocation/RoofAllocationSetting.jsx | 33 ++++++++++----- src/hooks/option/useCanvasSetting.js | 3 ++ .../roofcover/useRoofAllocationSetting.js | 41 ++++++++++++++++--- 4 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index 9c2ade43..c508ad37 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -263,7 +263,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set {raftCodes.map((raft, index) => { return ( @@ -157,11 +160,21 @@ export default function RoofAllocationSetting(props) {
- -
diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js index 26b78b51..59cb4eef 100644 --- a/src/hooks/option/useCanvasSetting.js +++ b/src/hooks/option/useCanvasSetting.js @@ -125,6 +125,9 @@ export function useCanvasSetting() { //์ง€๋ถ•์žฌ ์ดˆ๊ธฐ์„ธํŒ… const addRoofMaterials = async () => { + if (roofMaterials.length !== 0) { + return + } const { data } = await getRoofMaterialList() const roofLists = data.map((item, idx) => ({ ...item, diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index ff20c0cb..d2215131 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -1,6 +1,6 @@ import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil' import { canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom' -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { useSwal } from '@/hooks/useSwal' import { usePolygon } from '@/hooks/usePolygon' import { basicSettingState, roofDisplaySelector, roofMaterialsSelector, selectedRoofMaterialSelector } from '@/store/settingAtom' @@ -30,15 +30,12 @@ export function useRoofAllocationSetting(id) { const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) const [basicSetting, setBasicSetting] = useRecoilState(basicSettingState) const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // ํŒ์—… ๋‚ด ๊ธฐ์ค€ ์ง€๋ถ•์žฌ - const [roofList, setRoofList] = useState([]) + const [roofList, setRoofList] = useState(basicSetting.roofs) // ๋ฐฐ์น˜๋ฉด ์ดˆ๊ธฐ์„ค์ •์—์„œ ์„ ํƒํ•œ ์ง€๋ถ•์žฌ ๋ฐฐ์—ด const [editingLines, setEditingLines] = useState([]) + const isFirstRef = useRef(0) const { setSurfaceShapePattern } = useRoofFn() - useEffect(() => { - setRoofList(basicSetting.roofs) - }, [basicSetting]) - useEffect(() => { const roofBases = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) // roofPolygon.innerLines @@ -211,6 +208,11 @@ export function useRoofAllocationSetting(id) { // ์ง€๋ถ•์žฌ ๋ณ€๊ฒฝ const handleChangeRoofMaterial = (value, index) => { + if (isFirstRef.current === 0) { + isFirstRef.current++ + return + } + const selectedRoofMaterial = roofMaterials.find((roof) => roof.roofMatlCd === value.id) const newRoofList = roofList.map((roof, idx) => { if (idx === index) { @@ -231,6 +233,31 @@ export function useRoofAllocationSetting(id) { setRoofList(newRoofList) } + // ์„œ๊นŒ๋ž˜ ๋ณ€๊ฒฝ + const handleChangeRaft = (e, index) => { + const raftValue = e.value + + const newRoofList = roofList.map((roof, idx) => { + if (idx === index) { + return { ...roof, raft: raftValue } + } + return roof + }) + + setRoofList(newRoofList) + } + + const handleChangeLayout = (layoutValue, index) => { + const newRoofList = roofList.map((roof, idx) => { + if (idx === index) { + return { ...roof, layout: layoutValue } + } + return roof + }) + + setRoofList(newRoofList) + } + return { handleSave, onAddRoofMaterial, @@ -246,5 +273,7 @@ export function useRoofAllocationSetting(id) { roofList, handleDefaultRoofMaterial, handleChangeRoofMaterial, + handleChangeRaft, + handleChangeLayout, } } From 9f7bcd079141064399237bfb83c90207770619e0 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 18 Dec 2024 14:55:51 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=9A=A8fix:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EB=AC=B4=ED=95=9C=20=EB=A3=A8=ED=94=84=20=EB=8F=8C?= =?UTF-8?q?=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ๋กœ๊ทธ์ธ ๋กœ์ง ์ฒ˜๋ฆฌ ์ฝ”๋“œ ์ˆ˜์ • feat.leeyongjae --- src/app/layout.js | 1 - src/components/auth/Login.jsx | 6 ++--- src/lib/authActions.js | 51 ++++++++++++++++++----------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/app/layout.js b/src/app/layout.js index 3383aa10..0f688eea 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -50,7 +50,6 @@ export default async function RootLayout({ children }) { isLoggedIn: session.isLoggedIn, } } - if (!headerPathname.includes('/login') && !session.isLoggedIn) { redirect('/login') } diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index 98f7a5b6..02ccb16a 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -5,7 +5,7 @@ import Image from 'next/image' import Link from 'next/link' import { useRecoilState } from 'recoil' import { useAxios } from '@/hooks/useAxios' -import { setSession } from '@/lib/authActions' +import { setSession, login } from '@/lib/authActions' import { useMessage } from '@/hooks/useMessage' import { globalLocaleStore } from '@/store/localeAtom' import { sessionStore } from '@/store/commonAtom' @@ -87,7 +87,6 @@ export default function Login() { } await promisePost({ url: '/api/login/v1.0/login', data: param }) .then((res) => { - console.log('๐Ÿš€ ~ .then ~ res:', res) if (res) { if (res.data.result.resultCode === 'S') { setSession(res.data.data) @@ -98,7 +97,8 @@ export default function Login() { } else { Cookies.remove('chkLoginId') } - router.push('/') + // router.push('/') + login() } else { alert(res.data.result.resultMsg) } diff --git a/src/lib/authActions.js b/src/lib/authActions.js index 0834833e..929d3895 100644 --- a/src/lib/authActions.js +++ b/src/lib/authActions.js @@ -59,33 +59,36 @@ export async function setSession(data) { await session.save() } -export async function login(formData) { +export async function login() { const session = await getSession() - - const userId = formData.get('id') - const password = formData.get('password') - - console.log('id:', userId) - console.log('password:', password) - - // const loginUser = await getUserByIdAndPassword({ userId, password }) - const loginUser = { - id: 1, - userId: 'test123', - name: 'jinsoo Kim', - email: 'jinsoo.kim@example.com', + if (session) { + redirect('/') } - if (!loginUser) { - throw Error('Wrong Credentials!') - } + // const userId = formData.get('id') + // const password = formData.get('password') - session.name = loginUser.name - session.userId = loginUser.userId - session.email = loginUser.email - session.isLoggedIn = true - console.log('session:', session) + // console.log('id:', userId) + // console.log('password:', password) - await session.save() - redirect('/') + // // const loginUser = await getUserByIdAndPassword({ userId, password }) + // const loginUser = { + // id: 1, + // userId: 'test123', + // name: 'jinsoo Kim', + // email: 'jinsoo.kim@example.com', + // } + + // if (!loginUser) { + // throw Error('Wrong Credentials!') + // } + + // session.name = loginUser.name + // session.userId = loginUser.userId + // session.email = loginUser.email + // session.isLoggedIn = true + // console.log('session:', session) + + // await session.save() + // redirect('/') } From 2f4bb444a025fc2dac59de2ec9c16d50c3aaacaa Mon Sep 17 00:00:00 2001 From: leeyongjae Date: Wed, 18 Dec 2024 16:25:16 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=EC=9E=90=EB=8F=99=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20router=20push=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/Login.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index 02ccb16a..55711929 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -36,7 +36,7 @@ export default function Login() { const result = { ...response, storeLvl: response.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' } setSession(result) setSessionState(result) - router.push('/') + login() } else { router.push('/login') }