From 83476af5f396d688f471e9b189f28666d5c029d5 Mon Sep 17 00:00:00 2001 From: leeyongjae Date: Wed, 20 Nov 2024 16:48:33 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0,=20api=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/Login.jsx | 97 +++++++++-------------------------- 1 file changed, 25 insertions(+), 72 deletions(-) diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index 6060b308..af50a515 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -80,79 +80,32 @@ export default function Login() { e.preventDefault() const formData = new FormData(e.target) - /////////////////////////////////////////////////////////// - // 임시 로그인 처리 - setSession({ - userId: 'an1', - saleStoreId: null, - name: null, - mail: null, - tel: null, - storeId: 'X42', - userNm: 'ㅇㅇ6610', - userNmKana: '신규사용자 16610', - category: '인상6610', - telNo: '336610', - fax: null, - email: 't10t@naver.com', - pwdInitYn: 'Y', - storeLvl: '1', - groupId: '60000', - custCd: '100000', - }) - setSessionState({ - userId: 'an1', - saleStoreId: null, - name: null, - mail: null, - tel: null, - storeId: 'X42', - userNm: 'ㅇㅇ6610', - userNmKana: '신규사용자 16610', - category: '인상6610', - telNo: '336610', - fax: null, - email: 't10t@naver.com', - pwdInitYn: 'Y', - storeLvl: '1', - groupId: '60000', - custCd: '100000', - }) - if (chkLoginId) { - Cookies.set('chkLoginId', formData.get('id'), { expires: 7 }) - } else { - Cookies.remove('chkLoginId') + // 로그인 처리 시작 + const param = { + loginId: formData.get('id'), + pwd: formData.get('password'), } - router.push('/') - // 임시 로그인 처리 끝 - /////////////////////////////////////////////////////////// - - // 로그인 처리 시작 - ** 상단 임시 로그인 추후 삭제 필요 ** - // const param = { - // loginId: formData.get('id'), - // pwd: formData.get('password'), - // } - // await promisePost({ url: '/api/login/v1.0/login', data: param }) - // .then((res) => { - // if (res) { - // if (res.data.result.resultCode === 'S') { - // setSession(res.data.data) - // setSessionState(res.data.data) - // // ID SAVE 체크되어 있는 경우, 쿠키 저장 - // if (chkLoginId) { - // Cookies.set('chkLoginId', formData.get('id'), { expires: 7 }) - // } else { - // Cookies.remove('chkLoginId') - // } - // router.push('/') - // } else { - // alert(res.data.result.resultMsg) - // } - // } - // }) - // .catch((error) => { - // alert(error.response.data.message) - // }) + await promisePost({ url: '/api/login/v1.0/login', data: param }) + .then((res) => { + if (res) { + if (res.data.result.resultCode === 'S') { + setSession(res.data.data) + setSessionState(res.data.data) + // ID SAVE 체크되어 있는 경우, 쿠키 저장 + if (chkLoginId) { + Cookies.set('chkLoginId', formData.get('id'), { expires: 7 }) + } else { + Cookies.remove('chkLoginId') + } + router.push('/') + } else { + alert(res.data.result.resultMsg) + } + } + }) + .catch((error) => { + alert(error.response.data.message) + }) } // 비밀번호 초기화 관련