diff --git a/src/apis/queryHooks/Auth/useLogin.ts b/src/apis/queryHooks/Auth/useLogin.ts index ee24b756..d6190f65 100644 --- a/src/apis/queryHooks/Auth/useLogin.ts +++ b/src/apis/queryHooks/Auth/useLogin.ts @@ -1,7 +1,8 @@ import { useMutation } from '@tanstack/react-query'; import { AxiosError } from 'axios'; -import { useRouter, useSearchParams } from 'next/navigation'; +import { useRouter } from 'next/navigation'; +// useSearchParams import setTokenCookies from '@/apis/queryFunctions/setTokenCookies'; import { LoginParams } from '@/apis/types/Auth'; import { Response } from '@/apis/types/common'; @@ -10,9 +11,10 @@ import { useToast } from '@/provider/toastProvider'; function useLogin() { const router = useRouter(); - const searchParams = useSearchParams(); + // const searchParams = useSearchParams(); + // searchParams를 쓰면 서스펜스가 걸려서 에러가 발생함ㄴ - const prevUrl = searchParams.get('prevUrl'); + // const prevUrl = searchParams.get('prevUrl'); const { showToast } = useToast(); const { setIsLoggedIn } = useAuth(); @@ -23,11 +25,11 @@ function useLogin() { localStorage.setItem('refreshToken', data.refreshToken); setIsLoggedIn(true); showToast('success', '로그인 되었습니다.'); - if (prevUrl?.startsWith('/join') || prevUrl?.startsWith('/login')) { - router.push('/'); - } else { - router.push(prevUrl || '/'); - } + // if (prevUrl?.startsWith('/join') || prevUrl?.startsWith('/login')) { + router.push('/'); + // } else { + // router.push(prevUrl || '/'); + // } }, onError: (e: AxiosError>) => { if (e.response) { diff --git a/src/app/basicauction/[id]/BasicAuctionInfo.tsx b/src/app/basicauction/[id]/BasicAuctionInfo.tsx index 6d3a5386..43cfbfa0 100644 --- a/src/app/basicauction/[id]/BasicAuctionInfo.tsx +++ b/src/app/basicauction/[id]/BasicAuctionInfo.tsx @@ -1,6 +1,6 @@ 'use client'; -import React from 'react'; +import React, { Suspense } from 'react'; import dynamic from 'next/dynamic'; @@ -49,7 +49,9 @@ function BasicAuctionInfo({ id }: BasicAuctionInfoProps) { return (
- + Loading...}> + +
=> { + const queryValue = searchParams.categoryId; + + if (!queryValue) { + return getMetadata({ + title: 'ALL', + asPath: '/basicauction?page=1', + }); + } + try { - const queryValue = searchParams.categoryId; - if (!queryValue) { - return getMetadata({ - title: 'ALL', - asPath: '/basicauction?page=1', - }); - } const categoryListTree = await fetch( `${process.env.NEXT_PUBLIC_SERVER_API_URL}/api/v2/categories/${queryValue}`, ) @@ -39,15 +43,12 @@ export const generateMetadata = async ({ return getMetadata({ title: `${categoryName}`, asPath: `/basicauction?categoryId=${queryValue}&page=1`, - // TODO 예쁜 사진이 있다면 그것으로 카테고리를 나타내서 openGraphImage를 설정하면 좋을 듯함. }); } catch (error) { console.error(error); return getMetadata({ title: 'Auction Detail', asPath: `/basicauction`, - - // 잘못 되었을 떄 }); } }; @@ -56,17 +57,25 @@ function Home() { return (
- + AuctionCategoryLeftSection}> + +
- + BreadcrumbSection}> + +
- + MobileAuctionCategoryLeftSection}> + +
- + BasicAuctionClientPage}> + +
diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 78c4a6ad..ecf44371 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,3 +1,7 @@ +// import { Suspense } from 'react'; + +import { Suspense } from 'react'; + import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { Roboto } from 'next/font/google'; @@ -49,11 +53,14 @@ export default async function RootLayout({ - + Loading...NavigationEvents
}> + +
+ {/* Loading...
}> */} {children} diff --git a/src/app/mypage/heart/page.tsx b/src/app/mypage/heart/page.tsx index 47e44b47..de448229 100644 --- a/src/app/mypage/heart/page.tsx +++ b/src/app/mypage/heart/page.tsx @@ -1,5 +1,7 @@ 'use client'; +import { Suspense } from 'react'; + import { useRouter } from 'next/navigation'; import useGetAuctionLikeList from '@/apis/queryHooks/User/useGetAuctionLikeList'; @@ -55,18 +57,20 @@ function Home() { {data?.pages.map(page => page.result_data.content.map(item => ( - + AuctionCard}> + + )), )} diff --git a/src/components/AuctionList/index.tsx b/src/components/AuctionList/index.tsx index 711d97bb..82e1d6fa 100644 --- a/src/components/AuctionList/index.tsx +++ b/src/components/AuctionList/index.tsx @@ -1,5 +1,7 @@ 'use client'; +import { Suspense } from 'react'; + import { ArrowRightIcon } from 'lucide-react'; import Link from 'next/link'; @@ -44,19 +46,21 @@ export default function AuctionList({ sort, direction, pathname, path }: Auction
{data.result_data.content.map(item => ( - + AuctionCard}> + + ))}
diff --git a/src/components/BasicAuctionClientPage/index.tsx b/src/components/BasicAuctionClientPage/index.tsx index 90724d67..d6c61faa 100644 --- a/src/components/BasicAuctionClientPage/index.tsx +++ b/src/components/BasicAuctionClientPage/index.tsx @@ -1,5 +1,7 @@ 'use client'; +import { Suspense } from 'react'; + import { useRouter, useSearchParams } from 'next/navigation'; import useGetBasicAuctionList from '@/apis/queryHooks/basicAuction/useGetBasicAuctionList'; @@ -57,19 +59,21 @@ function BasicAuctionClientPage() { ) : ( {data.result_data.content.map(item => ( - + AuctionCard}> + + ))} )} diff --git a/src/components/Category/AuctionCategory/AuctionCategory.tsx b/src/components/Category/AuctionCategory/AuctionCategory.tsx index c6e96053..432ae852 100644 --- a/src/components/Category/AuctionCategory/AuctionCategory.tsx +++ b/src/components/Category/AuctionCategory/AuctionCategory.tsx @@ -1,3 +1,5 @@ +import { Suspense } from 'react'; + import { Category } from '@/apis/types/category'; import CategoryUnit from '@/components/Category/CategoryUnit/CategoryUnit'; import useSetSearchParams from '@/hooks/useSetSearchParam'; @@ -29,7 +31,10 @@ function AuctionCategory({ categoryData }: AuctionCategoryProps) { ALL {categoryData.map(category => ( - + // eslint-disable-next-line react/jsx-key + CategoryUnit}> + + ))}
); diff --git a/src/components/HeaderSection/components/CategoryHeader/index.tsx b/src/components/HeaderSection/components/CategoryHeader/index.tsx index 43298503..b952cc90 100644 --- a/src/components/HeaderSection/components/CategoryHeader/index.tsx +++ b/src/components/HeaderSection/components/CategoryHeader/index.tsx @@ -1,3 +1,5 @@ +import { Suspense } from 'react'; + import Link from 'next/link'; import { Category } from '@/apis/types/category'; @@ -25,7 +27,9 @@ function CategoryHeader({ data }: CategoryHeaderProps) { ))}
- + SearchBar}> + +
); diff --git a/src/components/HeaderSection/components/Header/Header.tsx b/src/components/HeaderSection/components/Header/Header.tsx index 444628df..fb883dd2 100644 --- a/src/components/HeaderSection/components/Header/Header.tsx +++ b/src/components/HeaderSection/components/Header/Header.tsx @@ -1,5 +1,7 @@ 'use client'; +import { Suspense } from 'react'; + import useGetCategory from '@/apis/queryHooks/category/useGetCategory'; import { Category } from '@/apis/types/category'; import MaxLayout from '@/components/MaxLayout'; @@ -18,7 +20,9 @@ function Header() {
- + UserHeader}> + +
diff --git a/src/components/HeaderSection/components/MobileHeader/MobileHeader.tsx b/src/components/HeaderSection/components/MobileHeader/MobileHeader.tsx index 61a3cd91..2da9332d 100644 --- a/src/components/HeaderSection/components/MobileHeader/MobileHeader.tsx +++ b/src/components/HeaderSection/components/MobileHeader/MobileHeader.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useEffect } from 'react'; +import { Suspense, useEffect } from 'react'; import useGetUser from '@/apis/queryHooks/User/useGetUser'; import useGetCategory from '@/apis/queryHooks/category/useGetCategory'; @@ -37,15 +37,18 @@ function MobileHeader() {
+ - + MobileSlideNav Loading...}> + +
diff --git a/src/components/HeaderSection/components/MobileUserHeader/index.tsx b/src/components/HeaderSection/components/MobileUserHeader/index.tsx index 9a7466b3..3622b3ba 100644 --- a/src/components/HeaderSection/components/MobileUserHeader/index.tsx +++ b/src/components/HeaderSection/components/MobileUserHeader/index.tsx @@ -1,3 +1,5 @@ +import { Suspense } from 'react'; + import { MenuIcon } from 'lucide-react'; import Image from 'next/image'; import Link from 'next/link'; @@ -17,7 +19,9 @@ function MobileUserHeader({ openNav }: MobileUserHeaderProps) {
- + SearchBar}> + +
logo