로그인 세션 값 체크 처리 수정 #534
This commit is contained in:
parent
4c1708d0dd
commit
9042a94c05
@ -55,10 +55,6 @@ export default async function RootLayout({ children }) {
|
||||
redirect('/login')
|
||||
}
|
||||
|
||||
if (headerPathname === '/login' && session.isLoggedIn) {
|
||||
redirect('/')
|
||||
}
|
||||
|
||||
return (
|
||||
<RecoilRootWrapper>
|
||||
<GlobalDataProvider>
|
||||
|
||||
@ -5,7 +5,7 @@ import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { useRecoilState } from 'recoil'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { setSession, login } from '@/lib/authActions'
|
||||
import { setSession, login, checkSession } from '@/lib/authActions'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { sessionStore } from '@/store/commonAtom'
|
||||
@ -21,11 +21,19 @@ export default function Login() {
|
||||
// 자동 로그인
|
||||
const initParams = useSearchParams()
|
||||
const autoLoginParam = initParams.get('autoLoginParam1')
|
||||
|
||||
useEffect(() => {
|
||||
if (autoLoginParam) {
|
||||
autoLoginProcess(autoLoginParam)
|
||||
}
|
||||
|
||||
checkSession().then((res) => {
|
||||
if (res) {
|
||||
login()
|
||||
}
|
||||
})
|
||||
}, [])
|
||||
|
||||
const autoLoginProcess = async (autoLoginParam) => {
|
||||
await promisePost({ url: '/api/login/v1.0/user/login/autoLoginDecryptData', data: { loginId: autoLoginParam } })
|
||||
.then((res) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user