diff --git a/src/components/auth/AutoLogin.jsx b/src/components/auth/AutoLogin.jsx
index d400f2c4..b3dcbb6e 100644
--- a/src/components/auth/AutoLogin.jsx
+++ b/src/components/auth/AutoLogin.jsx
@@ -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 && }
-
-
- {getMessage('site.name')}
- {getMessage('site.sub_name')}
-
-
-
- {getMessage('login.auto.page.text')}
+ {autoLoginParam !== 'Y' ? (
+ <>
+
+
+ {getMessage('site.name')}
+ {getMessage('site.sub_name')}
+
+
+
+ {getMessage('login.auto.page.text')}
+
+
-
-
+ >
+ ) : (
+ <>
+
+ >
+ )}
>
)
}
diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx
index 85e342d4..7a6ba957 100644
--- a/src/components/auth/Login.jsx
+++ b/src/components/auth/Login.jsx
@@ -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() {
>
)}
- {autoLoginParam && }
+ {autoLoginParam && }
COPYRIGHTΒ©2024 Hanwha Japan All Rights Reserved.
diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx
index a44af878..06df265d 100644
--- a/src/components/estimate/Estimate.jsx
+++ b/src/components/estimate/Estimate.jsx
@@ -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 = []
diff --git a/src/locales/ja.json b/src/locales/ja.json
index bfa010f5..f66fe445 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -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": "γγΉγ―γΌγγε
₯εγγ¦γγ γγγ",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 3d23d313..dc9b5d09 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -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": "λΉλ°λ²νΈλ₯Ό μ
λ ₯ν΄μ£ΌμΈμ.",