refactor: Refactoring router structure

This commit is contained in:
yoosangwook 2024-09-13 13:00:51 +09:00
parent ff564e73e5
commit fda37ff58a
30 changed files with 592 additions and 83 deletions

35
src/app/QcastProvider.js Normal file
View File

@ -0,0 +1,35 @@
'use client'
import { useEffect } from 'react'
import { useRecoilState, useRecoilValue } from 'recoil'
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
import { ErrorBoundary } from 'next/dist/client/components/error-boundary'
import ServerError from './error'
import '@/styles/common.scss'
import KO from '@/locales/ko.json'
import JA from '@/locales/ja.json'
export const QcastProvider = ({ children }) => {
const globalLocale = useRecoilValue(globalLocaleStore)
const [appMessageState, setAppMessageState] = useRecoilState(appMessageStore)
useEffect(() => {
console.log(sessionStorage.getItem('hi'))
console.log(Object.keys(appMessageState).length)
// if (Object.keys(appMessageState).length === 0) {
if (globalLocale === 'ko') {
setAppMessageState(KO)
} else {
setAppMessageState(JA)
}
// }
}, [globalLocale])
return (
<>
<ErrorBoundary fallback={<ServerError />}>{children}</ErrorBoundary>
</>
)
}

View File

@ -1,10 +1,8 @@
// import { getCurrentLocale } from '@/locales/server' import { getSession } from '@/lib/authActions'
import MainPage from '@/components/Main' import MainPage from '@/components/Main'
export default async function page() { export default async function page() {
// const session = await getSession() const session = await getSession()
// const currentLocale = getCurrentLocale()
const mainPageProps = { const mainPageProps = {
isLoggedIn: session?.isLoggedIn, isLoggedIn: session?.isLoggedIn,

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Archive from '@/components/community/Archive'
import { initCheck } from '@/util/session-util'
export default async function CommunityArchivePage() {
await initCheck()
return (
<>
<Hero title="자료 다운로드" />
<div className="container flex flex-wrap items-center justify-between mx-auto p-4 m-4 border">
<Archive />
</div>
</>
)
}

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Faq from '@/components/community/Faq'
import { initCheck } from '@/util/session-util'
export default async function CommunityFaqPage() {
await initCheck()
return (
<>
<Hero title="FAQ" />
<div className="container flex flex-wrap items-center justify-between mx-auto p-4 m-4 border">
<Faq />
</div>
</>
)
}

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Notice from '@/components/community/Notice'
import { initCheck } from '@/util/session-util'
export default async function CommunityNoticePage() {
await initCheck()
return (
<>
<Hero title="공지사항" />
<div className="container flex flex-wrap items-center justify-between mx-auto p-4 m-4 border">
<Notice />
</div>
</>
)
}

View File

@ -0,0 +1,9 @@
import FloorPlan from '@/components/floor-plan/FloorPlan'
export default function FloorPlanPage() {
return (
<>
<FloorPlan />
</>
)
}

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import InitSettingsModal from '@/components/InitSettingsModal'
import { initCheck } from '@/util/session-util'
export default async function InitSettingsModalPage() {
await initCheck()
return (
<>
<Hero title="Basic Settings" />
<div className="flex flex-col justify-center my-8">
<InitSettingsModal />
</div>
</>
)
}

14
src/app/intro/page.jsx Normal file
View File

@ -0,0 +1,14 @@
import Intro from '@/components/Intro'
import { initCheck } from '@/util/session-util'
export default async function IntroPage() {
await initCheck()
return (
<>
<div className="container mx-auto p-4 m-4 border">
<Intro />
</div>
</>
)
}

View File

@ -0,0 +1,19 @@
'use client'
import { useMessage } from '@/hooks/useMessage'
export default function CompletePage() {
const { getMessage } = useMessage()
return (
<>
<div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
<h1 className="text-center text-4xl font-bold mb-10">{getMessage('join.complete.title')}</h1>
<div className="mt-10 mb-10 w-full text-center text-2xl">{getMessage('join.complete.contents')}</div>
<div className="mt-10 w-full text-center">
{getMessage('join.complete.email_comment')} :&nbsp;{getMessage('join.complete.email')}
</div>
</div>
</>
)
}

5
src/app/join/page.jsx Normal file
View File

@ -0,0 +1,5 @@
import Join from '@/components/auth/Join'
export default function JoinPage() {
return <>{<Join />}</>
}

View File

@ -1,6 +1,8 @@
import { Inter } from 'next/font/google' import { Inter } from 'next/font/google'
import { checkSession, getSession } from '@/lib/authActions' import { headers } from 'next/headers'
import { redirect } from 'next/navigation'
import { getSession } from '@/lib/authActions'
import RecoilRootWrapper from './RecoilWrapper' import RecoilRootWrapper from './RecoilWrapper'
import UIProvider from './UIProvider' import UIProvider from './UIProvider'
@ -11,6 +13,7 @@ import QModal from '@/components/common/modal/QModal'
import './globals.css' import './globals.css'
import '../styles/style.scss' import '../styles/style.scss'
import { QcastProvider } from './QcastProvider'
const inter = Inter({ subsets: ['latin'] }) const inter = Inter({ subsets: ['latin'] })
@ -20,9 +23,16 @@ export const metadata = {
} }
export default async function RootLayout({ children }) { export default async function RootLayout({ children }) {
await checkSession() const headersList = headers()
const headerPathname = headersList.get('x-pathname') || ''
// console.log('headerPathname:', headerPathname)
// const isLoggedIn = await checkSession()
const session = await getSession() const session = await getSession()
console.log('session[layout]:', session) console.log('session[layout]:', session)
if (!headerPathname.includes('/login') && !session.isLoggedIn) {
redirect('/login')
}
return ( return (
<html lang="en"> <html lang="en">
@ -32,7 +42,9 @@ export default async function RootLayout({ children }) {
<div className="wrap"> <div className="wrap">
<Header loginedUserNm={session.userNm} /> <Header loginedUserNm={session.userNm} />
<div className="content"> <div className="content">
<UIProvider>{children}</UIProvider> <UIProvider>
<QcastProvider>{children}</QcastProvider>
</UIProvider>
</div> </div>
</div> </div>
<ToastContainer /> <ToastContainer />

9
src/app/login/page.jsx Normal file
View File

@ -0,0 +1,9 @@
import Login from '@/components/auth/Login'
export default function LoginPage() {
return (
<>
<Login />
</>
)
}

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Plan from '@/components/management/Plan'
import { initCheck } from '@/util/session-util'
export default async function ManagementPlanPage() {
await initCheck()
return (
<>
<Hero title="도면관리" />
<div className="container flex flex-wrap items-center justify-between mx-auto p-4 m-4 border">
<Plan />
</div>
</>
)
}

View File

@ -0,0 +1,15 @@
import React from 'react'
import Hero from '@/components/Hero'
import StuffDetail from '@/components/management/StuffDetail'
export default function ManagementStuffDetailPage() {
return (
<>
<div className="pt-48 flex justify-left">
<h1 className="text-4xl archivo-black-regular">물건정보</h1>
</div>
<div className="m2">
<StuffDetail />
</div>
</>
)
}

View File

@ -0,0 +1,21 @@
import StuffSearchCondition from '@/components/management/StuffSearchCondition'
import Stuff from '@/components/management/Stuff'
import { initCheck } from '@/util/session-util'
import Hero from '@/components/Hero'
export default async function ManagementStuffPage() {
await initCheck()
return (
<>
<Hero title="물건현황" />
<div>
<div className="m2">
<StuffSearchCondition />
</div>
</div>
<div className="flex flex-col justify-center my-8 pt-20">
<Stuff />
</div>
</>
)
}

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Company from '@/components/master/Company'
import { initCheck } from '@/util/session-util'
export default async function MasterCompanyPage() {
await initCheck()
return (
<>
<Hero title="회사정보 조회" />
<div className="container flex flex-wrap items-center justify-between mx-auto p-4 m-4 border">
<Company />
</div>
</>
)
}

View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Price from '@/components/master/Price'
import { initCheck } from '@/util/session-util'
export default async function MasterPricePage() {
await initCheck()
return (
<>
<Hero title="가격 마스터 조회" />
<div className="container flex flex-wrap items-center justify-between mx-auto p-4 m-4 border">
<Price />
</div>
</>
)
}

View File

@ -1,5 +1,16 @@
import Main from '@/components/Main' import MainPage from '@/components/Main'
import { getSession } from '@/lib/authActions'
export default function Home() { export default async function Home() {
return <Main /> const session = await getSession()
const mainPageProps = {
isLoggedIn: session?.isLoggedIn,
}
return (
<>
<MainPage {...mainPageProps} />
</>
)
} }

View File

@ -0,0 +1,17 @@
import Playground from '@/components/Playground'
import { initCheck } from '@/util/session-util'
export default async function PlaygroundPage() {
// const { session } = await checkSession()
// if (!session.isLoggedIn) {
// redirect('/login')
// }
await initCheck()
return (
<>
<Playground />
</>
)
}

16
src/app/roof/page.jsx Normal file
View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Roof from '@/components/Roof'
import { initCheck } from '@/util/session-util'
export default async function RoofPage() {
await initCheck()
return (
<>
<Hero title="Drawing on canvas 2D Roof" />
<div className="flex flex-col justify-center my-8">
<Roof />
</div>
</>
)
}

View File

@ -0,0 +1,128 @@
'use client'
import { Select, SelectItem } from '@nextui-org/react'
import { useEffect, useState } from 'react'
import { useAxios } from '@/hooks/useAxios'
export default function RoofSelect() {
const [roofMaterials, setRoofMaterials] = useState([])
const [manufacturers, setManufacturers] = useState([])
const [trestles, setTrestles] = useState([])
const [modules, setModules] = useState([])
const [originTrestles, setOriginTrestles] = useState([])
const [roofMaterialId, setRoofMaterialId] = useState(null)
const [manufacturerId, setManufacturerId] = useState(null)
const [trestleId, setTrestleId] = useState(null)
const { get } = useAxios()
useEffect(() => {
get({ url: '/api/roof-material/roof-material-infos' }).then((res) => {
//TODO: error handling
if (!res) return
setRoofMaterials(res)
})
}, [])
useEffect(() => {
if (!roofMaterialId) {
return
}
get({ url: `/api/roof-material/roof-material-infos/${roofMaterialId}/trestles` }).then((res) => {
if (res.length === 0) {
return
}
setOriginTrestles(res)
const manufactural = res.map((trestle) => {
return { id: trestle.manufacturerId, name: trestle.manufacturerName }
})
// Remove duplicates
const uniqueManufactural = Array.from(new Set(manufactural.map((a) => a.id))).map((id) => {
return manufactural.find((a) => a.id === id)
})
setManufacturers(uniqueManufactural)
})
}, [roofMaterialId])
useEffect(() => {
if (!manufacturerId) {
return
}
const trestles = originTrestles.filter((trestle) => trestle.manufacturerId === manufacturerId)
setTrestles(trestles)
}, [manufacturerId])
useEffect(() => {
if (!trestleId) {
return
}
get({ url: `/api/module/module-infos?roofMaterialId=${roofMaterialId}&trestleId=${trestleId}` }).then((res) => {
if (res.length === 0) {
return
}
setModules(res)
})
}, [trestleId])
const handleRoofMaterialOnChange = (e) => {
const roofMaterialId = e.target.value
setRoofMaterialId(roofMaterialId)
setManufacturers([])
setManufacturerId(null)
setTrestleId(null)
setTrestles([])
setModules([])
}
const handleManufacturersOnChange = (e) => {
const manufacturerId = Number(e.target.value)
setTrestles([])
setManufacturerId(manufacturerId)
setTrestleId(null)
setModules([])
}
const handleTrestlesOnChange = (e) => {
const trestleId = Number(e.target.value)
setTrestleId(trestleId)
setModules([])
}
return (
<div className="flex w-full flex-wrap md:flex-nowrap gap-4">
{roofMaterials.length > 0 && (
<Select label="지붕재" className="max-w-xs" onChange={handleRoofMaterialOnChange}>
{roofMaterials.map((roofMaterial) => (
<SelectItem key={roofMaterial.id}>{roofMaterial.name}</SelectItem>
))}
</Select>
)}
{manufacturers.length > 0 && (
<Select label="제조 회사" className="max-w-xs" onChange={handleManufacturersOnChange}>
{manufacturers.map((manufacturer) => (
<SelectItem key={manufacturer.id}>{manufacturer.name}</SelectItem>
))}
</Select>
)}
{trestles.length > 0 && (
<Select label="가대" className="max-w-xs" onChange={handleTrestlesOnChange}>
{trestles.map((trestle) => (
<SelectItem key={trestle.id}>{trestle.name}</SelectItem>
))}
</Select>
)}
{modules.length > 0 && (
<Select label="설치가능 모듈" className="max-w-xs">
{modules.map((module) => (
<SelectItem key={module.id}>{module.name}</SelectItem>
))}
</Select>
)}
</div>
)
}

26
src/app/roof2/page.jsx Normal file
View File

@ -0,0 +1,26 @@
import Roof2 from '@/components/Roof2'
import RoofSelect from '@/app/[locale]/roof2/RoofSelect'
import { initCheck } from '@/util/session-util'
export default async function Roof2Page() {
const session = await initCheck()
const roof2Props = {
name: session.name || '',
userId: session.userId || '',
email: session.email || '',
isLoggedIn: session.isLoggedIn,
}
return (
<>
<div>
<div className="m-2">
<RoofSelect />
</div>
</div>
<div className="flex flex-col justify-center my-8 pt-20">
<Roof2 {...roof2Props} />
</div>
</>
)
}

16
src/app/settings/page.jsx Normal file
View File

@ -0,0 +1,16 @@
import Hero from '@/components/Hero'
import Settings from '@/components/Settings'
import { initCheck } from '@/util/session-util'
export default async function SettingsPage() {
await initCheck()
return (
<>
<Hero title="Canvas Setting" />
<div className="flex flex-col justify-center my-8">
<Settings />
</div>
</>
)
}

View File

@ -1,6 +1,7 @@
'use client' 'use client'
import { post, patch } from '@/lib/Axios' import { useState } from 'react'
import { useAxios } from '@/hooks/useAxios'
import { setSession } from '@/lib/authActions' import { setSession } from '@/lib/authActions'
import { redirect } from 'next/navigation' import { redirect } from 'next/navigation'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
@ -9,9 +10,10 @@ import { Button, Switch } from '@nextui-org/react'
import { useRecoilState } from 'recoil' import { useRecoilState } from 'recoil'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { modalContent, modalState } from '@/store/modalAtom' import { modalContent, modalState } from '@/store/modalAtom'
import { useState } from 'react'
export default function Login(props) { export default function Login(props) {
const { patch } = useAxios()
const { currentLocale } = props const { currentLocale } = props
const { getMessage } = useMessage() const { getMessage } = useMessage()
const [globalLocaleState, setGlbalLocaleState] = useRecoilState(globalLocaleStore) const [globalLocaleState, setGlbalLocaleState] = useRecoilState(globalLocaleStore)

View File

@ -1,11 +1,12 @@
'use client' 'use client'
import { Fragment } from 'react'
import Link from 'next/link' import Link from 'next/link'
import { usePathname } from 'next/navigation' import { usePathname, useRouter } from 'next/navigation'
import { useMessage } from '@/hooks/useMessage' import { useMessage } from '@/hooks/useMessage'
import QSelectBox from '@/components/common/select/QSelectBox'
import React from 'react'
import { logout } from '@/lib/authActions' import { logout } from '@/lib/authActions'
import QSelectBox from '@/components/common/select/QSelectBox'
export const ToggleonMouse = (e, act, target) => { export const ToggleonMouse = (e, act, target) => {
const listWrap = e.target.closest(target) const listWrap = e.target.closest(target)
const ListItem = Array.from(listWrap.childNodes) const ListItem = Array.from(listWrap.childNodes)
@ -25,31 +26,29 @@ export default function Header(props) {
const { loginedUserNm } = props const { loginedUserNm } = props
const { getMessage } = useMessage() const { getMessage } = useMessage()
const pathName = usePathname() const pathName = usePathname()
// if (pathName.includes('login') || pathName.includes('join')) {
if (pathName.includes('login') || pathName.includes('join')) { // return null
return null // }
}
const SelectOption = [{ name: 'オンライン保証シ' }, { name: 'ステム' }] const SelectOption = [{ name: 'オンライン保証シ' }, { name: 'ステム' }]
const onLogout = () => {
logout()
}
const menus = [ const menus = [
{ name: 'header.menus.home', url: '/', children: [] }, { id: 0, name: 'header.menus.home', url: '/', children: [] },
{ {
id: 1,
name: 'header.menus.management', name: 'header.menus.management',
url: '', url: '',
children: [ children: [
{ name: 'header.menus.management.stuff', url: '/management/stuff', children: [] }, { id: 3, name: 'header.menus.management.stuff', url: '/management/stuff', children: [] },
{ name: 'header.menus.management.plan', url: '/floor-plan', children: [] }, { id: 4, name: 'header.menus.management.plan', url: '/floor-plan', children: [] },
], ],
}, },
{ {
id: 2,
name: 'header.menus.community', name: 'header.menus.community',
url: '', url: '',
children: [ children: [
{ name: 'header.menus.community.notice', url: '/community/notice', children: [] }, { id: 5, name: 'header.menus.community.notice', url: '/community/notice', children: [] },
{ name: 'header.menus.community.faq', url: '/community/faq', children: [] }, { id: 6, name: 'header.menus.community.faq', url: '/community/faq', children: [] },
{ name: 'header.menus.community.archive', url: '/community/archive', children: [] }, { id: 7, name: 'header.menus.community.archive', url: '/community/archive', children: [] },
], ],
}, },
] ]
@ -58,35 +57,33 @@ export default function Header(props) {
return menus.map((menu) => { return menus.map((menu) => {
return ( return (
<li <li
key={`${menu.name}-mn1`} key={`${menu.id}`}
className={'nav-item'} className={'nav-item'}
onMouseEnter={(e) => ToggleonMouse(e, 'add', 'nav > ul')} onMouseEnter={(e) => ToggleonMouse(e, 'add', 'nav > ul')}
onMouseLeave={(e) => ToggleonMouse(e, 'remove', 'nav > ul')} onMouseLeave={(e) => ToggleonMouse(e, 'remove', 'nav > ul')}
> >
{menu.children.length === 0 ? ( {menu.children.length === 0 ? (
<Link key={`${menu.name}-link`} href={menu.url}> <Link key={`${menu.id}`} href={menu.url}>
{getMessage(menu.name)} {getMessage(menu.name)}
</Link> </Link>
) : ( ) : (
<React.Fragment key={`${menu.name}-frag`}> <Fragment key={`${menu.id}`}>
<button>{getMessage(menu.name)}</button> <button>{getMessage(menu.name)}</button>
<ul className="nav-depth2"> <ul className="nav-depth2">
{menu.children.map((m) => { {menu.children.map((m) => {
return ( return (
<li <li
key={`${m.name}-mn2`} key={`${m.id}`}
className={'nav-depth2-item'} className={'nav-depth2-item'}
onMouseEnter={(e) => ToggleonMouse(e, 'add', 'li > ul')} onMouseEnter={(e) => ToggleonMouse(e, 'add', 'li > ul')}
onMouseLeave={(e) => ToggleonMouse(e, 'remove', 'li > ul')} onMouseLeave={(e) => ToggleonMouse(e, 'remove', 'li > ul')}
> >
<Link key={`${m.name}-link`} href={m.url}> <Link href={m.url}>{getMessage(m.name)}</Link>
{getMessage(m.name)}
</Link>
</li> </li>
) )
})} })}
</ul> </ul>
</React.Fragment> </Fragment>
)} )}
</li> </li>
) )
@ -94,33 +91,35 @@ export default function Header(props) {
} }
return ( return (
<header> !(pathName.includes('login') || pathName.includes('join')) && (
<div className="header-inner"> <header>
<div className="header-right"> <div className="header-inner">
<h1 className="logo"> <div className="header-right">
<Link href={'/'}></Link> <h1 className="logo">
</h1> <Link href={'/'}></Link>
<nav> </h1>
<ul className="nav-list ">{getMenuTemplate(menus)}</ul> <nav>
</nav> <ul className="nav-list ">{getMenuTemplate(menus)}</ul>
</div> </nav>
<div className="header-left">
<div className="profile-box">
<button className="profile">{loginedUserNm}</button>
</div> </div>
<div className="sign-out-box"> <div className="header-left">
<button className="sign-out" onClick={onLogout}> <div className="profile-box">
{getMessage('header.logout')} <button className="profile">{loginedUserNm}</button>
</button> </div>
</div> <div className="sign-out-box">
<div className="select-box"> <button className="sign-out" onClick={() => logout()}>
<QSelectBox title={'Q.ORDER'} option={SelectOption} /> {getMessage('header.logout')}
</div> </button>
<div className="btn-wrap"> </div>
<button className="btn-frame small dark">{getMessage('header.go')}</button> <div className="select-box">
<QSelectBox title={'Q.ORDER'} option={SelectOption} />
</div>
<div className="btn-wrap">
<button className="btn-frame small dark">{getMessage('header.go')}</button>
</div>
</div> </div>
</div> </div>
</div> </header>
</header> )
) )
} }

View File

@ -0,0 +1,5 @@
import style from '@/components/ui/Loading.module.css'
export default function Loading() {
return <span className={style.loader}></span>
}

View File

@ -0,0 +1,35 @@
.loader {
position: relative;
font-size: 48px;
letter-spacing: 6px;
}
.loader:before {
content: 'Loading';
color: #fff;
}
.loader:after {
content: '';
width: 20px;
height: 20px;
background-color: #ff3d00;
background-image: radial-gradient(circle 2px, #fff4 100%, transparent 0), radial-gradient(circle 1px, #fff3 100%, transparent 0);
background-position:
14px -4px,
12px -1px;
border-radius: 50%;
position: absolute;
margin: auto;
top: -5px;
right: 66px;
transform-origin: center bottom;
animation: fillBaloon 1s ease-in-out infinite alternate;
}
@keyframes fillBaloon {
0% {
transform: scale(1);
}
100% {
transform: scale(3);
}
}

View File

@ -38,6 +38,10 @@ export function useAxios() {
.catch(console.error) .catch(console.error)
} }
const promiseGet = async ({ url }) => {
return await getInstances(url).get(url)
}
const post = async ({ url, data }) => { const post = async ({ url, data }) => {
return await getInstances(url) return await getInstances(url)
.post(url, data) .post(url, data)
@ -70,5 +74,5 @@ export function useAxios() {
.catch(console.error) .catch(console.error)
} }
return { get, post, promisePost, put, patch, del } return { get, promiseGet, post, promisePost, put, patch, del }
} }

View File

@ -28,9 +28,10 @@ export async function getSession() {
export async function checkSession() { export async function checkSession() {
const session = await getSession() const session = await getSession()
if (!session.isLoggedIn) { // if (!session.isLoggedIn) {
redirect('/login') // redirect('/login')
} // }
return session.isLoggedIn
} }
export async function setSession(data) { export async function setSession(data) {

View File

@ -1,27 +1,27 @@
import { createI18nMiddleware } from 'next-international/middleware' // import { createI18nMiddleware } from 'next-international/middleware'
const I18nMiddleware = createI18nMiddleware({ // const I18nMiddleware = createI18nMiddleware({
locales: ['ko', 'ja'], // locales: ['ko', 'ja'],
defaultLocale: 'ko', // defaultLocale: 'ko',
}) // })
export function middleware(request) { // export function middleware(request) {
return I18nMiddleware(request) // return I18nMiddleware(request)
} // }
export const config = { export const config = {
matcher: ['/((?!api|static|.*\\..*|_next|favicon.ico|robots.txt).*)'], matcher: ['/((?!api|static|.*\\..*|_next|favicon.ico|robots.txt).*)'],
} }
// import { NextRequest, NextResponse } from 'next/server' import { NextRequest, NextResponse } from 'next/server'
// export function middleware(request) { export function middleware(request) {
// const requestHeaders = new Headers(request.headers) const requestHeaders = new Headers(request.headers)
// requestHeaders.set('x-pathname', request.nextUrl.pathname) requestHeaders.set('x-pathname', request.nextUrl.pathname)
// return NextResponse.next({ return NextResponse.next({
// request: { request: {
// headers: requestHeaders, headers: requestHeaders,
// }, },
// }) })
// } }