Merge branch 'dev' into dev-yj-layoutSetup
This commit is contained in:
commit
ad14bf091f
@ -2,26 +2,111 @@
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { setSession, login } from '@/lib/authActions'
|
||||
import { sessionStore } from '@/store/commonAtom'
|
||||
import { useRecoilState } from 'recoil'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { useRouter } from 'next/navigation'
|
||||
|
||||
import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
|
||||
|
||||
export default function AutoLoginPage() {
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
export default function AutoLoginPage({ autoLoginParam }) {
|
||||
const router = useRouter()
|
||||
|
||||
const [isLoading, setIsLoading] = useState(autoLoginParam === 'Y' ? false : true)
|
||||
const [globalLocaleState, setGlbalLocaleState] = useRecoilState(globalLocaleStore)
|
||||
|
||||
const { promisePost } = useAxios(globalLocaleState)
|
||||
const { getMessage } = useMessage()
|
||||
|
||||
const [userId, setUserId] = useState('')
|
||||
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
||||
|
||||
const [idFocus, setIdFocus] = useState(false)
|
||||
|
||||
const loginProcess = async () => {
|
||||
setIsLoading(true)
|
||||
await promisePost({ url: '/api/login/v1.0/user', data: { loginId: userId } }).then((response) => {
|
||||
setIsLoading(false)
|
||||
if (response.data) {
|
||||
const res = response.data
|
||||
const result = { ...res, storeLvl: res.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
|
||||
setSession(result)
|
||||
setSessionState(result)
|
||||
login()
|
||||
} else {
|
||||
alert(getMessage('login.fail'))
|
||||
router.push('/login?autoLoginParam1=Y')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{isLoading && <GlobalSpinner />}
|
||||
<div className="login-input-frame">
|
||||
<div className="login-frame-tit ">
|
||||
<span>{getMessage('site.name')}</span>
|
||||
{getMessage('site.sub_name')}
|
||||
</div>
|
||||
<div className="login-input-wrap">
|
||||
<div className="login-area id" style={{ fontWeight: 'bolder' }}>
|
||||
{getMessage('login.auto.page.text')}
|
||||
{autoLoginParam !== 'Y' ? (
|
||||
<>
|
||||
<div className="login-input-frame">
|
||||
<div className="login-frame-tit ">
|
||||
<span>{getMessage('site.name')}</span>
|
||||
{getMessage('site.sub_name')}
|
||||
</div>
|
||||
<div className="login-input-wrap">
|
||||
<div className="login-area id" style={{ fontWeight: 'bolder' }}>
|
||||
{getMessage('login.auto.page.text')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="login-input-frame">
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
loginProcess()
|
||||
}}
|
||||
className="space-y-6"
|
||||
>
|
||||
<div className="login-frame-tit">
|
||||
<span>{getMessage('site.name')}</span>
|
||||
{getMessage('site.sub_name')}
|
||||
</div>
|
||||
<div className="login-input-wrap">
|
||||
<div className={`login-area id ${idFocus ? 'focus' : ''}`}>
|
||||
<input
|
||||
type="text"
|
||||
className="login-input"
|
||||
id="userId"
|
||||
name="id"
|
||||
required
|
||||
value={userId}
|
||||
placeholder={getMessage('login.id.placeholder')}
|
||||
onChange={(e) => {
|
||||
setUserId(e.target.value)
|
||||
}}
|
||||
onFocus={() => setIdFocus(true)}
|
||||
onBlur={() => setIdFocus(false)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="id-delete"
|
||||
onClick={(e) => {
|
||||
setUserId('')
|
||||
}}
|
||||
></button>
|
||||
</div>
|
||||
<div className="login-btn-box">
|
||||
<button type="submit" className="login-btn">
|
||||
{getMessage('login')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -25,7 +25,9 @@ export default function Login() {
|
||||
|
||||
useEffect(() => {
|
||||
if (autoLoginParam) {
|
||||
autoLoginProcess(autoLoginParam)
|
||||
if (autoLoginParam !== 'Y') {
|
||||
autoLoginProcess(autoLoginParam)
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('🚀 ~ checkSession ~ checkSession():', checkSession())
|
||||
@ -334,7 +336,7 @@ export default function Login() {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{autoLoginParam && <AutoLogin />}
|
||||
{autoLoginParam && <AutoLogin autoLoginParam={autoLoginParam} />}
|
||||
</div>
|
||||
<div className="login-copyright">COPYRIGHT©2024 Hanwha Japan All Rights Reserved.</div>
|
||||
</div>
|
||||
|
||||
@ -377,8 +377,8 @@ export default function Estimate({}) {
|
||||
useEffect(() => {
|
||||
if (estimateContextState.estimateType !== '') {
|
||||
const param = {
|
||||
saleStoreId: session.storeId,
|
||||
sapSalesStoreCd: session.custCd,
|
||||
saleStoreId: estimateContextState.sapSaleStoreId,
|
||||
sapSalesStoreCd: estimateContextState.sapSalesStoreCd,
|
||||
docTpCd: estimateContextState?.estimateType,
|
||||
}
|
||||
|
||||
@ -481,8 +481,8 @@ export default function Estimate({}) {
|
||||
//Pricing 버튼
|
||||
const handlePricing = async (showPriceCd) => {
|
||||
const param = {
|
||||
saleStoreId: session.storeId,
|
||||
sapSalesStoreCd: session.custCd,
|
||||
saleStoreId: estimateContextState.sapSaleStoreId,
|
||||
sapSalesStoreCd: estimateContextState.sapSalesStoreCd,
|
||||
docTpCd: estimateContextState.estimateType,
|
||||
priceCd: showPriceCd,
|
||||
itemIdList: estimateContextState.itemList.filter((item) => item.delFlg === '0' && item.paDispOrder === null),
|
||||
@ -506,7 +506,6 @@ export default function Estimate({}) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
setIsGlobalLoading(true)
|
||||
await promisePost({ url: '/api/estimate/price/item-price-list', data: param }).then((res) => {
|
||||
let updateList = []
|
||||
|
||||
@ -594,6 +594,7 @@
|
||||
"myinfo.message.password.error": "パスワードが間違っています。",
|
||||
"login": "ログイン",
|
||||
"login.auto.page.text": "自動ログイン中です。",
|
||||
"login.fail": "アカウントが存在しないか、パスワードが間違っています。",
|
||||
"login.id.save": "ID保存",
|
||||
"login.id.placeholder": "IDを入力してください。",
|
||||
"login.password.placeholder": "パスワードを入力してください。",
|
||||
|
||||
@ -594,6 +594,7 @@
|
||||
"myinfo.message.password.error": "비밀번호가 틀렸습니다.",
|
||||
"login": "로그인",
|
||||
"login.auto.page.text": "자동로그인 중 입니다.",
|
||||
"login.fail": "계정이 없거나 비밀번호가 잘못되었습니다.",
|
||||
"login.id.save": "ID Save",
|
||||
"login.id.placeholder": "아이디를 입력해주세요.",
|
||||
"login.password.placeholder": "비밀번호를 입력해주세요.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user