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) + }) } // 비밀번호 초기화 관련