diff --git a/src/app/(pages)/mypage/components/sections/CommentsSection.tsx b/src/app/(pages)/mypage/components/sections/CommentsSection.tsx index 00106efa..2430f926 100644 --- a/src/app/(pages)/mypage/components/sections/CommentsSection.tsx +++ b/src/app/(pages)/mypage/components/sections/CommentsSection.tsx @@ -9,6 +9,7 @@ import ContentSection from "@/app/components/layout/ContentSection"; import useWidth from "@/hooks/useWidth"; import ScrollTopButton from "@/app/components/button/default/ScrollTopButton"; import SamllLoadingSpinner from "@/app/components/loading-spinner/SmallLoadingSpinner"; +import LoadingSpinner from "@/app/components/loading-spinner/LoadingSpinner"; export default function CommentsSection() { const [currentPage, setCurrentPage] = useState(1); @@ -43,6 +44,10 @@ export default function CommentsSection() { window.scrollTo(0, 0); }; + if (isLoading) { + return ; + } + if (error) { return (
diff --git a/src/app/(pages)/mypage/components/sections/PostsSection.tsx b/src/app/(pages)/mypage/components/sections/PostsSection.tsx index dc486fdf..c4badb21 100644 --- a/src/app/(pages)/mypage/components/sections/PostsSection.tsx +++ b/src/app/(pages)/mypage/components/sections/PostsSection.tsx @@ -11,6 +11,8 @@ import ScrollTopButton from "@/app/components/button/default/ScrollTopButton"; import BoardPostItem from "@/app/components/card/board/BoardPostItem"; import DotLoadingSpinner from "@/app/components/loading-spinner/DotLoadingSpinner"; import SamllLoadingSpinner from "@/app/components/loading-spinner/SmallLoadingSpinner"; +import LoadingSpinner from "@/app/components/loading-spinner/LoadingSpinner"; +import { useUser } from "@/hooks/queries/user/me/useUser"; export default function PostsSection() { const { orderBy } = useMySortStore(); @@ -36,7 +38,7 @@ export default function PostsSection() { limit: postsPerPage, orderBy: orderBy.posts, }); - + const { user } = useUser(); useEffect(() => { if (inView && hasNextPage && !isFetchingNextPage) { fetchNextPage(); @@ -51,6 +53,10 @@ export default function PostsSection() { ); } + if (isLoading) { + return ; + } + return (
{/* 메인 콘텐츠 영역 */} @@ -70,7 +76,13 @@ export default function PostsSection() { {data.pages.map((page) => ( {page.data.map((post) => ( - + ))} ))} diff --git a/src/app/(pages)/mypage/page.tsx b/src/app/(pages)/mypage/page.tsx index 5bf7c185..f17c7a5b 100644 --- a/src/app/(pages)/mypage/page.tsx +++ b/src/app/(pages)/mypage/page.tsx @@ -6,10 +6,13 @@ import CommentsSection from "./components/sections/CommentsSection"; import ScrapsSection from "./components/sections/ScrapsSection"; import { userRoles } from "@/constants/userRoles"; import { useUser } from "@/hooks/queries/user/me/useUser"; +import toast from "react-hot-toast"; +import { useRouter } from "next/navigation"; export default function MyPage() { const searchParams = useSearchParams(); const currentTab = searchParams.get("tab") || "posts"; + const router = useRouter(); const { user } = useUser(); const isApplicant = user?.role === userRoles.APPLICANT; @@ -19,5 +22,10 @@ export default function MyPage() { ...(isApplicant && { scrap: }), }[currentTab]; + if (!user) { + toast.error("로그인이 필요한 페이지입니다."); + router.push("/login"); + } + return TabContent; } diff --git a/src/app/components/button/dropdown/KebabDropdown.tsx b/src/app/components/button/dropdown/KebabDropdown.tsx index 4ecb5c15..36db0a06 100644 --- a/src/app/components/button/dropdown/KebabDropdown.tsx +++ b/src/app/components/button/dropdown/KebabDropdown.tsx @@ -29,11 +29,14 @@ const KebabDropdown = ({ options, className = "" }: KebabDropdownProps) => {
{isOpen && ( @@ -42,7 +45,8 @@ const KebabDropdown = ({ options, className = "" }: KebabDropdownProps) => { {showDropdown && ( -
+
{isApplicant ? ( <>