-
- {getMessage('login.auto.page.text')}
+ <>
+ {isLoading &&
}
+
+
+ {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 eca80361..b23f9c53 100644
--- a/src/components/auth/Login.jsx
+++ b/src/components/auth/Login.jsx
@@ -10,14 +10,15 @@ import { useMessage } from '@/hooks/useMessage'
import { globalLocaleStore } from '@/store/localeAtom'
import { sessionStore } from '@/store/commonAtom'
import { useRouter } from 'next/navigation'
-
-import Cookies from 'js-cookie'
-
import { useSearchParams } from 'next/navigation'
+import GlobalSpinner from '@/components/common/spinner/GlobalSpinner'
+import Cookies from 'js-cookie'
import AutoLogin from './AutoLogin'
export default function Login() {
+ const [isLoading, setIsLoading] = useState(false)
+
// 자동 로그인
const initParams = useSearchParams()
const autoLoginParam = initParams.get('autoLoginParam1')
@@ -35,11 +36,13 @@ export default function Login() {
}, [])
const autoLoginProcess = async (autoLoginParam) => {
+ setIsLoading(true)
await promisePost({ url: '/api/login/v1.0/user/login/autoLoginDecryptData', data: { loginId: autoLoginParam } })
.then((res) => {
if (res) {
if (res.data) {
post({ url: '/api/login/v1.0/user', data: { loginId: res.data } }).then((response) => {
+ setIsLoading(false)
if (response) {
const result = { ...response, storeLvl: response.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
setSession(result)
@@ -53,6 +56,7 @@ export default function Login() {
}
})
.catch((error) => {
+ setIsLoading(false)
router.push('/login')
})
}
@@ -93,9 +97,11 @@ export default function Login() {
loginId: formData.get('id'),
pwd: formData.get('password'),
}
+ setIsLoading(true)
await promisePost({ url: '/api/login/v1.0/login', data: param })
.then((res) => {
if (res) {
+ setIsLoading(false)
if (res.data.result.resultCode === 'S') {
setSession(res.data.data)
setSessionState(res.data.data)
@@ -105,7 +111,6 @@ export default function Login() {
} else {
Cookies.remove('chkLoginId')
}
- // router.push('/')
login()
} else {
alert(res.data.result.resultMsg)
@@ -113,6 +118,7 @@ export default function Login() {
}
})
.catch((error) => {
+ setIsLoading(false)
alert(error.response.data.message)
})
}
@@ -123,12 +129,14 @@ export default function Login() {
loginId: checkId,
email: checkEmail,
}
+ setIsLoading(true)
await promisePatch({
url: '/api/login/v1.0/user/init-password',
data: param,
})
.then((res) => {
if (res) {
+ setIsLoading(false)
if (res.data.result.resultCode == 'S') {
alert(getMessage('login.init_password.complete_message'))
setCheckId('')
@@ -140,36 +148,135 @@ export default function Login() {
}
})
.catch((error) => {
+ setIsLoading(false)
alert(error.response.data.message)
})
}
return (
-
-
-
-
-
- {!autoLoginParam && passwordReset === 1 && (
- <>
-