Merge pull request '로그인, 로그아웃 추적' (#754) from dev into dev-deploy
Reviewed-on: #754
This commit is contained in:
commit
e7c4202fb5
@ -107,6 +107,7 @@ export default function Login() {
|
|||||||
if (res) {
|
if (res) {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
if (res.data.result.resultCode === 'S') {
|
if (res.data.result.resultCode === 'S') {
|
||||||
|
Cookies.set('sessionId', res.data.sessionId)
|
||||||
setSession(res.data.data)
|
setSession(res.data.data)
|
||||||
setSessionState(res.data.data)
|
setSessionState(res.data.data)
|
||||||
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
||||||
|
|||||||
@ -8,7 +8,8 @@ import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
|||||||
import { dimmedStore, sessionStore } from '@/store/commonAtom'
|
import { dimmedStore, sessionStore } from '@/store/commonAtom'
|
||||||
|
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { checkSession, logout } from '@/lib/authActions'
|
import { checkSession } from '@/lib/authActions'
|
||||||
|
import { useLogout } from '@/hooks/useLogout'
|
||||||
|
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ export default function Header(props) {
|
|||||||
const { promiseGet } = useAxios()
|
const { promiseGet } = useAxios()
|
||||||
|
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
const { logoutProcess } = useLogout()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지붕재 목록 Header에서 조회
|
* 지붕재 목록 Header에서 조회
|
||||||
@ -372,14 +374,7 @@ export default function Header(props) {
|
|||||||
<div className="sign-out-box">
|
<div className="sign-out-box">
|
||||||
<button
|
<button
|
||||||
className="sign-out"
|
className="sign-out"
|
||||||
onClick={() => {
|
onClick={() => logoutProcess()}
|
||||||
setStuffSearch({
|
|
||||||
...stuffSearch,
|
|
||||||
code: 'DELETE',
|
|
||||||
})
|
|
||||||
logout()
|
|
||||||
router.replace('/login', undefined, { shallow: true })
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{getMessage('header.logout')}
|
{getMessage('header.logout')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -5,7 +5,8 @@ import { sessionStore } from '@/store/commonAtom'
|
|||||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { login, logout, setSession } from '@/lib/authActions'
|
import { login, setSession } from '@/lib/authActions'
|
||||||
|
import { useLogout } from '@/hooks/useLogout'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
@ -17,6 +18,7 @@ export default function ChangePasswordPop(props) {
|
|||||||
|
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { patch } = useAxios(globalLocaleState)
|
const { patch } = useAxios(globalLocaleState)
|
||||||
|
const { logoutProcess } = useLogout()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -129,15 +131,13 @@ export default function ChangePasswordPop(props) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
logout()
|
logoutProcess()
|
||||||
router.replace('/login', undefined, { shallow: true })
|
|
||||||
console.log('code not 200 error')
|
console.log('code not 200 error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
logout()
|
logoutProcess()
|
||||||
router.replace('/login', undefined, { shallow: true })
|
|
||||||
console.log('catch::::::::', error)
|
console.log('catch::::::::', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -209,10 +209,7 @@ export default function ChangePasswordPop(props) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-origin grey"
|
className="btn-origin grey"
|
||||||
onClick={() => {
|
onClick={() => logoutProcess()}
|
||||||
logout()
|
|
||||||
router.replace('/login', undefined, { shallow: true })
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{getMessage('main.popup.login.btn2')}
|
{getMessage('main.popup.login.btn2')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user