최초사용자 비밀번호 변경 후 바로 로그인
This commit is contained in:
parent
15100eda6d
commit
36739e7bec
@ -2,24 +2,20 @@
|
|||||||
import { useEffect, useState, useContext } from 'react'
|
import { useEffect, useState, useContext } from 'react'
|
||||||
|
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
import { useRecoilState } from 'recoil'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
|
||||||
import MainContents from './main/MainContents'
|
import MainContents from './main/MainContents'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { stuffSearchState } from '@/store/stuffAtom'
|
import { stuffSearchState } from '@/store/stuffAtom'
|
||||||
import '@/styles/contents.scss'
|
import '@/styles/contents.scss'
|
||||||
import ChangePasswordPop from './main/ChangePasswordPop'
|
import ChangePasswordPop from './main/ChangePasswordPop'
|
||||||
import { searchState } from '@/store/boardAtom'
|
import { searchState } from '@/store/boardAtom'
|
||||||
import { SessionContext } from '@/app/SessionProvider'
|
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
|
|
||||||
export default function MainPage(mainPageProps) {
|
export default function MainPage() {
|
||||||
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
||||||
const [chagePasswordPopOpen, setChagePasswordPopOpen] = useState(false)
|
const [chagePasswordPopOpen, setChagePasswordPopOpen] = useState(false)
|
||||||
const { session } = useContext(SessionContext)
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { sessionStore } from '@/store/commonAtom'
|
|||||||
import { useRecoilValue, useRecoilState } from 'recoil'
|
import { useRecoilValue, useRecoilState } from 'recoil'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { logout } from '@/lib/authActions'
|
import { logout, setSession, login } from '@/lib/authActions'
|
||||||
export default function ChangePasswordPop(props) {
|
export default function ChangePasswordPop(props) {
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
|
||||||
@ -84,7 +84,11 @@ 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()
|
const result = { ...sessionState, pwdInitYn: 'Y' }
|
||||||
|
setSession(result)
|
||||||
|
setSessionState(result)
|
||||||
|
props.setChagePasswordPopOpen(false)
|
||||||
|
login()
|
||||||
} else {
|
} else {
|
||||||
alert(res?.result?.resultMsg)
|
alert(res?.result?.resultMsg)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user