최초사용자 비밀번호 변경 후 바로 로그인

This commit is contained in:
basssy 2025-01-09 13:03:28 +09:00
parent 15100eda6d
commit 36739e7bec
2 changed files with 8 additions and 8 deletions

View File

@ -2,24 +2,20 @@
import { useEffect, useState, useContext } from 'react'
import { useRouter } from 'next/navigation'
import { useRecoilState, useRecoilValue } from 'recoil'
import { useAxios } from '@/hooks/useAxios'
import { globalLocaleStore } from '@/store/localeAtom'
import { useRecoilState } from 'recoil'
import MainContents from './main/MainContents'
import { useMessage } from '@/hooks/useMessage'
import { stuffSearchState } from '@/store/stuffAtom'
import '@/styles/contents.scss'
import ChangePasswordPop from './main/ChangePasswordPop'
import { searchState } from '@/store/boardAtom'
import { SessionContext } from '@/app/SessionProvider'
import { QcastContext } from '@/app/QcastProvider'
import { sessionStore } from '@/store/commonAtom'
import { isObjectNotEmpty } from '@/util/common-utils'
export default function MainPage(mainPageProps) {
export default function MainPage() {
const [sessionState, setSessionState] = useRecoilState(sessionStore)
const [chagePasswordPopOpen, setChagePasswordPopOpen] = useState(false)
const { session } = useContext(SessionContext)
const router = useRouter()
const { getMessage } = useMessage()

View File

@ -5,7 +5,7 @@ import { sessionStore } from '@/store/commonAtom'
import { useRecoilValue, useRecoilState } from 'recoil'
import { useAxios } from '@/hooks/useAxios'
import { globalLocaleStore } from '@/store/localeAtom'
import { logout } from '@/lib/authActions'
import { logout, setSession, login } from '@/lib/authActions'
export default function ChangePasswordPop(props) {
const globalLocaleState = useRecoilValue(globalLocaleStore)
@ -84,7 +84,11 @@ export default function ChangePasswordPop(props) {
if (res?.result?.code === 200) {
if (res?.result?.resultCode === 'S') {
alert(getMessage('main.popup.login.success'))
logout()
const result = { ...sessionState, pwdInitYn: 'Y' }
setSession(result)
setSessionState(result)
props.setChagePasswordPopOpen(false)
login()
} else {
alert(res?.result?.resultMsg)
}