Q.order, Q.mosubi 자동로그인 추가/session 정보 추가/response 메시지 처리 수정
This commit is contained in:
parent
8ffdf5dca9
commit
82f3af907f
@ -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"
|
||||
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"
|
||||
@ -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"
|
||||
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"
|
||||
@ -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,
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
@ -35,7 +35,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="modal-popup community">
|
||||
<div key={noticeNo} className="modal-popup community">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
@ -57,7 +57,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) {
|
||||
<dl className="community_detail-file-wrap">
|
||||
<dt>첨부파일 목록</dt>
|
||||
{boardDetail.listFile.map((boardFile) => (
|
||||
<dd key={boardFile}>
|
||||
<dd key={boardFile.encodeFileNo}>
|
||||
<button type="button" className="down" onClick={() => handleFileDown(boardFile)}>
|
||||
{boardFile.srcFileNm}
|
||||
</button>
|
||||
|
||||
@ -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) {
|
||||
</button>
|
||||
</div>
|
||||
<div className="select-box">
|
||||
<QSelectBox title={'Q.ORDER'} options={SelectOptions} onChange={onChangeSelect} />
|
||||
<QSelectBox options={SelectOptions} onChange={onChangeSelect} />
|
||||
</div>
|
||||
<div className="btn-wrap">
|
||||
<button className="btn-frame small dark" onClick={() => navPage()}>
|
||||
|
||||
@ -11,7 +11,6 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
||||
const { get, promisePatch } = useAxios()
|
||||
const [info, setInfo] = useState({
|
||||
userId: '',
|
||||
password: '',
|
||||
name: '',
|
||||
nameKana: '',
|
||||
category: '',
|
||||
@ -30,7 +29,7 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
const url = `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/my-info/my-profile`
|
||||
const url = `/api/my-info/my-profile`
|
||||
const params = new URLSearchParams({ userId: userId })
|
||||
|
||||
const apiUrl = `${url}?${params.toString()}`
|
||||
@ -39,7 +38,6 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
||||
|
||||
if (resultData) {
|
||||
setInfo(resultData)
|
||||
setPassword(resultData?.password)
|
||||
} else {
|
||||
alert(getMessage('common.message.no.data'))
|
||||
}
|
||||
@ -72,11 +70,11 @@ export default function UserInfoModal({ userId, userInfoModal, setUserInfoModal
|
||||
await promisePatch({ url: '/api/login/v1.0/user/change-password', data: params })
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
if (res.result.resultCode === 'S') {
|
||||
if (res.data.result.resultCode === 'S') {
|
||||
alert(getMessage('myinfo.message.save'))
|
||||
setChkChgPwd(false)
|
||||
} else {
|
||||
alert(res.result.resultMsg)
|
||||
alert(res.data.result.resultMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -49,6 +49,8 @@ export async function setSession(data) {
|
||||
session.telNo = data.telNo
|
||||
session.fax = data.fax
|
||||
session.email = data.email
|
||||
session.storeLvl = data.storeLvl
|
||||
session.groupId = data.groupId
|
||||
session.pwdInitYn = data.pwdInitYn
|
||||
session.isLoggedIn = true
|
||||
// console.log('session:', session)
|
||||
|
||||
@ -9,10 +9,10 @@ export const handleFileDown = async (file) => {
|
||||
encodeFileNo: file.encodeFileNo,
|
||||
})
|
||||
const apiUrl = `${url}?${params.toString()}`
|
||||
await promiseGet({ url: apiUrl })
|
||||
await promiseGet({ url: apiUrl, responseType: 'blob' })
|
||||
.then((resultData) => {
|
||||
if (resultData) {
|
||||
const blob = new Blob([resultData])
|
||||
const blob = new Blob([resultData.data], { type: resultData.headers['content-type'] || 'application/octet-stream' })
|
||||
const fileUrl = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
|
||||
@ -21,7 +21,7 @@ export const handleFileDown = async (file) => {
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
window.URL.revokeObjectURL(url)
|
||||
window.URL.revokeObjectURL(fileUrl)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user