비밀번호 변경팝업
This commit is contained in:
parent
6db65f6173
commit
7aac1bbfeb
@ -13,7 +13,6 @@ import ChangePasswordPop from './main/ChangePasswordPop'
|
|||||||
import { searchState } from '@/store/boardAtom'
|
import { searchState } from '@/store/boardAtom'
|
||||||
import { SessionContext } from '@/app/SessionProvider'
|
import { SessionContext } from '@/app/SessionProvider'
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
import { getSession } from '@/lib/authActions'
|
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
|
|
||||||
export default function MainPage(mainPageProps) {
|
export default function MainPage(mainPageProps) {
|
||||||
@ -21,9 +20,6 @@ export default function MainPage(mainPageProps) {
|
|||||||
const [chagePasswordPopOpen, setChagePasswordPopOpen] = useState(false)
|
const [chagePasswordPopOpen, setChagePasswordPopOpen] = useState(false)
|
||||||
const { session } = useContext(SessionContext)
|
const { session } = useContext(SessionContext)
|
||||||
|
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
|
||||||
|
|
||||||
const { promiseGet } = useAxios(globalLocaleState)
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
|
|
||||||
@ -77,15 +73,11 @@ export default function MainPage(mainPageProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('mainPageProps:::', mainPageProps)
|
if (sessionState?.pwdInitYn !== 'Y') {
|
||||||
if (mainPageProps?.pwdInitYn !== 'Y') {
|
|
||||||
setChagePasswordPopOpen(true)
|
setChagePasswordPopOpen(true)
|
||||||
}
|
}
|
||||||
}, [mainPageProps])
|
}, [sessionState])
|
||||||
|
|
||||||
console.log('sessionState::', sessionState)
|
|
||||||
console.log('session::', session)
|
|
||||||
console.log('mainPageProps::', mainPageProps)
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(!chagePasswordPopOpen && (
|
{(!chagePasswordPopOpen && (
|
||||||
|
|||||||
@ -89,7 +89,6 @@ export default function Login() {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.data.result.resultCode === 'S') {
|
if (res.data.result.resultCode === 'S') {
|
||||||
console.log('res.data.data::', res.data.data)
|
|
||||||
setSession(res.data.data)
|
setSession(res.data.data)
|
||||||
setSessionState(res.data.data)
|
setSessionState(res.data.data)
|
||||||
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { useAxios } from '@/hooks/useAxios'
|
|||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { setSession } from '@/lib/authActions'
|
import { setSession } from '@/lib/authActions'
|
||||||
|
import { logout } from '@/lib/authActions'
|
||||||
export default function ChangePasswordPop(props) {
|
export default function ChangePasswordPop(props) {
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
|
||||||
@ -77,18 +77,21 @@ export default function ChangePasswordPop(props) {
|
|||||||
if (res?.result?.code === 200) {
|
if (res?.result?.code === 200) {
|
||||||
if (res?.result?.resultCode === 'S') {
|
if (res?.result?.resultCode === 'S') {
|
||||||
alert(getMessage('main.popup.login.success'))
|
alert(getMessage('main.popup.login.success'))
|
||||||
|
logout()
|
||||||
//로그인 화면으로 이동해서 다시 로그인해야되서 setSessionState필요없음
|
//로그인 화면으로 이동해서 다시 로그인해야되서 setSessionState필요없음
|
||||||
// setSessionState({ ...sessionState, pwdInitYn: 'Y' })
|
// setSessionState({ ...sessionState, pwdInitYn: 'Y' })
|
||||||
props.setChagePasswordPopOpen(false)
|
//props.setChagePasswordPopOpen(false)
|
||||||
router.push('/login')
|
//router.push('/login')
|
||||||
} else {
|
} else {
|
||||||
alert(res?.result?.resultMsg)
|
alert(res?.result?.resultMsg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
logout()
|
||||||
console.log('code not 200 error')
|
console.log('code not 200 error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
logout()
|
||||||
console.log('catch::::::::', error)
|
console.log('catch::::::::', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -165,7 +168,8 @@ export default function ChangePasswordPop(props) {
|
|||||||
type="button"
|
type="button"
|
||||||
className="btn-origin grey"
|
className="btn-origin grey"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.push('/login')
|
logout()
|
||||||
|
// router.push('/login')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getMessage('main.popup.login.btn2')}
|
{getMessage('main.popup.login.btn2')}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user