-
+
{children}
diff --git a/src/components/Main.jsx b/src/components/Main.jsx
index 224ce1ea..4546f32d 100644
--- a/src/components/Main.jsx
+++ b/src/components/Main.jsx
@@ -1,62 +1,9 @@
'use client'
-import { logout } from '@/lib/authActions'
-import { useChangeLocale, useI18n } from '@/locales/client'
-import { Button, Chip } from '@nextui-org/react'
-import Link from 'next/link'
-
export default function MainPage(props) {
- const { currentLocale, isLoggedIn } = props
- const t = useI18n()
- const changeLocale = useChangeLocale()
-
- const handleChangeLocale = () => {
- currentLocale === 'ja' ? changeLocale('ko') : changeLocale('ja')
- }
-
- // console.log('MainPage', currentLocale)
-
- const handleLogout = async () => {
- await logout()
- }
-
return (
<>
-
{t('locale', { locale: {currentLocale} })}
-
{t('hello')}
-
{t('welcome', { name: '효준' })}
-
-
-
- {isLoggedIn && (
-
-
-
- )}
- {!isLoggedIn && (
-
-
-
-
-
- )}
-
font-test
- {/*
{t('locale', { locale: {currentLocale} })}
*/}
- {/*
{t('hello')}
*/}
- {/*
{t('welcome', { name: '효준' })}
*/}
- {/*
*/}
- {/* */}
- {/*
*/}
- {/*{isLoggedIn && (*/}
- {/*
*/}
- {/* */}
- {/*
*/}
- {/*)}*/}
- {/*
font-test
*/}
+
Main page
>
)
}
diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx
index f81a0ca7..5335eaab 100644
--- a/src/components/header/Header.jsx
+++ b/src/components/header/Header.jsx
@@ -1,8 +1,9 @@
'use client'
import Link from 'next/link'
-import QSelectBox from '@/components/common/select/QSelectBox'
import { usePathname } from 'next/navigation'
import { useMessage } from '@/hooks/useMessage'
+import QSelectBox from '@/components/common/select/QSelectBox'
+import { getSession } from '@/lib/authActions'
export const ToggleonMouse = (e, act, target) => {
const listWrap = e.target.closest(target)
@@ -19,7 +20,9 @@ export const ToggleonMouse = (e, act, target) => {
}
}
-export default function Header() {
+export default function Header(props) {
+ const { loginedUserNm } = props
+ // console.log('loginedUserNm:', loginedUserNm)
const { getMessage } = useMessage()
const pathName = usePathname()
if (pathName.includes('login') || pathName.includes('join')) {
@@ -101,7 +104,7 @@ export default function Header() {
-
+
diff --git a/src/lib/authActions.js b/src/lib/authActions.js
index 06c02ef0..eafddadd 100644
--- a/src/lib/authActions.js
+++ b/src/lib/authActions.js
@@ -27,6 +27,14 @@ export async function getSession() {
return session
}
+export async function checkSession() {
+ const session = await getSession()
+
+ if (!session.isLoggedIn) {
+ redirect('/login')
+ }
+}
+
export async function setSession(data) {
const session = await getSession()