비밀번호팝업
This commit is contained in:
parent
986b5b21fe
commit
be152e3f4b
@ -15,6 +15,7 @@ import { SessionContext } from '@/app/SessionProvider'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
|
||||
export default function MainPage() {
|
||||
const [chagePasswordPopOpen, setChagePasswordPopOpen] = useState(false)
|
||||
const { session } = useContext(SessionContext)
|
||||
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
@ -72,9 +73,15 @@ export default function MainPage() {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (session?.pwdInitYn !== 'Y') {
|
||||
setChagePasswordPopOpen(true)
|
||||
}
|
||||
}, [session])
|
||||
|
||||
return (
|
||||
<>
|
||||
{(session?.pwdInitYn !== 'N' && (
|
||||
{(!chagePasswordPopOpen && (
|
||||
<>
|
||||
<div className="background-bord"></div>
|
||||
<div className="main-contents">
|
||||
@ -118,7 +125,7 @@ export default function MainPage() {
|
||||
</>
|
||||
)) || (
|
||||
<>
|
||||
<ChangePasswordPop />
|
||||
<ChangePasswordPop setChagePasswordPopOpen={setChagePasswordPopOpen} />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
@ -6,8 +6,9 @@ import { useRecoilValue, useRecoilState } from 'recoil'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { setSession } from '@/lib/authActions'
|
||||
|
||||
export default function ChangePasswordPop() {
|
||||
export default function ChangePasswordPop(props) {
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
|
||||
const { patch } = useAxios(globalLocaleState)
|
||||
@ -77,6 +78,7 @@ export default function ChangePasswordPop() {
|
||||
alert(getMessage('main.popup.login.success'))
|
||||
setSessionState({ ...sessionState, pwdInitYn: 'Y' })
|
||||
//메인으로 이동
|
||||
props.setChagePasswordPopOpen(false)
|
||||
router.push('/')
|
||||
} else {
|
||||
alert(res.result.resultMsg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user