diff --git a/.env.development b/.env.development index 468efc67..933db5d3 100644 --- a/.env.development +++ b/.env.development @@ -8,4 +8,7 @@ DATABASE_URL="sqlserver://mssql.devgrr.kr:1433;database=qcast;user=qcast;passwor SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" -NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" \ No newline at end of file +NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" + +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-local.q-cells.jp:8120/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-local.q-cells.jp:8120/qm/login/autoLogin" \ No newline at end of file diff --git a/.env.production b/.env.production index 2c41bf76..9bad1719 100644 --- a/.env.production +++ b/.env.production @@ -6,4 +6,7 @@ DATABASE_URL="" SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" -NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" \ No newline at end of file +NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" + +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-local.q-cells.jp:8120/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-local.q-cells.jp:8120/qm/login/autoLogin" \ No newline at end of file diff --git a/src/app/layout.js b/src/app/layout.js index 28626654..d27522fe 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -48,6 +48,8 @@ export default async function RootLayout({ children }) { telNo: session.telNo, fax: session.fax, email: session.email, + storeLvl: session.storeLvl, + groupId: session.groupId, pwdInitYn: session.pwdInitYn, isLoggedIn: session.isLoggedIn, } diff --git a/src/components/auth/Join.jsx b/src/components/auth/Join.jsx index aa2e21ca..3412efdb 100644 --- a/src/components/auth/Join.jsx +++ b/src/components/auth/Join.jsx @@ -37,11 +37,11 @@ export default function Join() { await promisePost({ url: '/api/login/v1.0/user/join', data: param }) .then((res) => { if (res) { - if (res.result.resultCode == 'S') { + if (res.data.result.resultCode == 'S') { Cookies.set('joinEmail', formData.get('email'), { expires: 1 }) router.push('/join/complete') } else { - alert(res.result.resultMsg) + alert(res.data.result.resultMsg) } } }) diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx index 69d02e21..c43341e3 100644 --- a/src/components/auth/Login.jsx +++ b/src/components/auth/Login.jsx @@ -13,7 +13,59 @@ import { useRouter } from 'next/navigation' import Cookies from 'js-cookie' +import { useSearchParams } from 'next/navigation' + export default function Login() { + //////////////////////////////////////////////////////////////////////////////// + // 자동 로그인 작업진행중 + const initParams = useSearchParams() + const autoLoginParam = initParams.get('autoLoginParam1') + useEffect(() => { + if (autoLoginParam) { + autoLoginProcess(autoLoginParam) + } + }, []) + const autoLoginProcess = async (autoLoginParam) => { + setSession({ + userId: autoLoginParam, + saleStoreId: null, + name: null, + mail: null, + tel: null, + storeId: 'TEMP02', + userNm: 'ㅇㅇ6610', + userNmKana: '신규사용자 16610', + category: '인상6610', + telNo: '336610', + fax: null, + email: 't10t@naver.com', + pwdInitYn: 'Y', + storeLvl: '2', + groupId: '70000', + }) + + setSessionState({ + userId: autoLoginParam, + saleStoreId: null, + name: null, + mail: null, + tel: null, + storeId: 'TEMP02', + userNm: 'ㅇㅇ6610', + userNmKana: '신규사용자 16610', + category: '인상6610', + telNo: '336610', + fax: null, + email: 't10t@naver.com', + pwdInitYn: 'Y', + storeLvl: '2', + groupId: '70000', + }) + + router.push('/') + } + //////////////////////////////////////////////////////////////////////////////// + const [userId, setUserId] = useState('') const [checkId, setCheckId] = useState('') const [checkEmail, setCheckEmail] = useState('') @@ -55,6 +107,8 @@ export default function Login() { fax: null, email: 't10t@naver.com', pwdInitYn: 'Y', + storeLvl: '1', + groupId: '60000', }) setSessionState({ @@ -71,6 +125,8 @@ export default function Login() { fax: null, email: 't10t@naver.com', pwdInitYn: 'Y', + storeLvl: '1', + groupId: '60000', }) // ID SAVE 체크되어 있는 경우, 쿠키 저장 @@ -91,9 +147,9 @@ export default function Login() { // await promisePost({ url: '/api/login/v1.0/login', data: param }) // .then((res) => { // if (res) { - // if (res.result.resultCode == 'S') { - // setSession(res.data) - // setSessionState(res.data) + // 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 }) @@ -102,7 +158,7 @@ export default function Login() { // } // router.push('/') // } else { - // alert(res.result.resultMsg) + // alert(res.data.result.resultMsg) // } // } // }) @@ -124,13 +180,13 @@ export default function Login() { }) .then((res) => { if (res) { - if (res.result.resultCode == 'S') { + if (res.data.result.resultCode == 'S') { alert(getMessage('login.init_password.complete_message')) setCheckId('') setCheckEmail('') setPasswordReset(1) } else { - alert(res.result.resultMsg) + alert(res.data.result.resultMsg) } } }) diff --git a/src/components/community/ArchiveTable.jsx b/src/components/community/ArchiveTable.jsx index 318badef..ef6b303b 100644 --- a/src/components/community/ArchiveTable.jsx +++ b/src/components/community/ArchiveTable.jsx @@ -20,7 +20,7 @@ export default function ArchiveTable({ clsCode }) { // 목록 조회 useEffect(() => { async function fetchData() { - const url = `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/board/list` + const url = `/api/board/list` const params = new URLSearchParams({ schNoticeTpCd: 'QC', schNoticeClsCd: clsCode, @@ -49,7 +49,7 @@ export default function ArchiveTable({ clsCode }) { // 상세 파일 목록 조회 const handleDetailFileListDown = async (noticeNo) => { - const url = `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/board/detail` + const url = `/api/board/detail` const params = new URLSearchParams({ noticeNo: noticeNo, }) diff --git a/src/components/community/modal/BoardDetailModal.jsx b/src/components/community/modal/BoardDetailModal.jsx index dec5e09a..ec324966 100644 --- a/src/components/community/modal/BoardDetailModal.jsx +++ b/src/components/community/modal/BoardDetailModal.jsx @@ -35,7 +35,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) { return ( <> -
+
@@ -57,7 +57,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) {
첨부파일 목록
{boardDetail.listFile.map((boardFile) => ( -
+
diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index c9b89658..c12d237e 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -13,6 +13,8 @@ import { logout } from '@/lib/authActions' import QSelectBox from '@/components/common/select/QSelectBox' import UserInfoModal from '@/components/myInfo/UserInfoModal' +import { useAxios } from '@/hooks/useAxios' +import { globalLocaleStore } from '@/store/localeAtom' export const ToggleonMouse = (e, act, target) => { const listWrap = e.target.closest(target) @@ -44,12 +46,42 @@ export default function Header(props) { const dimmedState = useRecoilValue(dimmedStore) const isDimmed = dimmedState ? 'opacity-50 bg-black' : '' - const SelectOptions = [ - { id: 0, name: 'オンライン保証シ', link: '' }, - { id: 1, name: 'ステム', link: '' }, - { id: 2, name: 'TEST1', link: 'https://www.weather.go.kr/w/index.do' }, - { id: 3, name: 'TEST2', link: 'https://www.google.com' }, - ] + // Link 이동 자동 로그인 + const [globalLocaleState, setGlbalLocaleState] = useRecoilState(globalLocaleStore) + const { promisePost } = useAxios(globalLocaleState) + + const qOrderUrl = process.env.NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL + const qMusubiUrl = process.env.NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL + + const [SelectOptions, setSelectOptions] = useState( + userSession.groupId === '60000' ? [{ id: 0, name: 'Q.ORDER', link: `${qOrderUrl}` }] : [{ id: 1, name: 'Q.Musubi', link: `${qMusubiUrl}` }], + ) + + const getAutoLoginParam = async () => { + await promisePost({ url: '/api/login/v1.0/user/login/autoLoginEncryptData', data: { loginId: userSession.userId } }) + .then((res) => { + if (res) { + setSelectOptions( + userSession.groupId === '60000' + ? [{ id: 0, name: 'Q.ORDER', link: `${qOrderUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` }] + : [{ id: 1, name: 'Q.Musubi', link: `${qMusubiUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` }], + ) + setSelected( + userSession.groupId === '60000' + ? { id: 0, name: 'Q.ORDER', link: `${qOrderUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` } + : { id: 1, name: 'Q.Musubi', link: `${qMusubiUrl}?autoLoginParam1=${encodeURIComponent(res.data)}` }, + ) + } + }) + .catch((error) => { + alert(error.response.data.message) + }) + } + + useEffect(() => { + getAutoLoginParam() + }, [userSession]) + const menus = [ { id: 0, name: 'header.menus.home', url: '/', children: [] }, { @@ -157,7 +189,7 @@ export default function Header(props) {
- +