로그인 후 다른 메듀 이동후 로그아웃. 뒤로가기하면 메인으로 이동되는 현상 처리
This commit is contained in:
parent
5da9b0d196
commit
6bdfac04e7
@ -4,13 +4,22 @@ import { useContext, useEffect } from 'react'
|
||||
import { useAxios } from '../useAxios'
|
||||
import { SessionContext } from '@/app/SessionProvider'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
import { checkSession } from '@/lib/authActions'
|
||||
import { useRouter } from 'next/navigation'
|
||||
|
||||
export const useMainContentsController = () => {
|
||||
const { session } = useContext(SessionContext)
|
||||
const { promiseGet } = useAxios()
|
||||
const { setQcastState, setIsGlobalLoading } = useContext(QcastContext)
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
console.log('111111111111111111111111111111')
|
||||
checkSession().then((res) => {
|
||||
if (!res) {
|
||||
router.replace('/login')
|
||||
}
|
||||
})
|
||||
setIsGlobalLoading(true)
|
||||
}, [])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user