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